This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Getting rid of namespace attribute under SQL2000 XML output


Hi everyone,

I just love answering my own questions...:-)

Anyway, after searching the archive and playing around some more, I managed
to solve the namespace problem. Turns out IE5.5 did have a bug understanding
(or rather ignoring) the "xmlns" attribute. From a previous thread, I
understand that the output of these namespace declarations are by design.
Any good reasons for this?

I changed my FILTER.XSL file as follows and data binding worked - first
time.

<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
	xmlns:sql="urn:schemas-microsoft-com:xml-sql"
	exclude-result-prefixes="sql">
<xsl:output omit-xml-declaration="yes"/>

<xsl:template match="/ | @* | node()">
  <xsl:copy>
    <xsl:apply-templates select="*"/>
  </xsl:copy>
</xsl:template>

<xsl:template match="*">
  <xsl:element name="{name()}">
    <xsl:apply-templates select="* | @* | node()"/>
  </xsl:element>
</xsl:template>

</xsl:stylesheet>

Any comments?

Francois

-----Original Message-----
From: owner-xsl-list@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Francois
Rautenbach
Sent: 17 April 2002 19:48
To: xsl-list@lists.mulberrytech.com
Subject: [xsl] Getting rid of namespace attribute under SQL2000 XML
output


Hi everyone,

Been monitoring the list for a while, but this is my first question.

I am receiving XML data from a SQL-2000 database using XML templates. The
XML is well formed and I have no problem using this in my "normal" XML apps.
When using XML data binding under HTML (IE5), Internet Explorer silently
refuse to bind to the XML that I receive from SQL-2000, yet is works
perfectly on my own hand created data. I subsequently discovered that IE5
chokes on the -> xmlns:sql="urn:schemas-microsoft-com:xml-sql" <- attribute
in the XML (see below). Remove this and data binding works perfectly.

<?xml version="1.0" encoding="UTF-8" ?>
<root xmlns:sql="urn:schemas-microsoft-com:xml-sql">
  <row ITEM_ID="1" ITEM_CODE="TF225" ITEM..../>
  ..
  ..etc
  ..
</root>

My question is: I wrote a FILTER.XSL to get rid of xmlns:sql attribute, but
it just keeps popping up in different places, like at the end of the <row>
tag! I tried probably 20 different ways, no luck. Sorry, I cannot list all
the things I tried, but this is basically what I am trying to do.

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template match="/">
  <xsl:copy>
    <xsl:apply-templates select="*"/>
  </xsl:copy>
</xsl:template>

<xsl:template match="* | @*">
  <xsl:copy>
    <xsl:apply-templates select="* | @*"/>
  </xsl:copy>
</xsl:template>

</xsl:stylesheet>

The -> exclude-result-prefixes="sql" <- statement didn't do it for me too.

Neither did:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template match="* | @*">
  <xsl:copy>
    <xsl:apply-templates select="* | @*"/>
  </xsl:copy>
</xsl:template>

<xsl:template match="@xmlns:sql">
</xsl:template>

</xsl:stylesheet>

Any help or pointers, even if I am doing my data binding wrong would be
helpful. (I know this is outside the scope of this list, so please email me
direct if you prefer.)

Thanks,
Francois


Sample of my HTML that does data binding to the above XML:

<xml id="DSO1" src="http://intranet/database/xml/StockItemView.xml";></xml>
<span datasrc="#DSO1" datafld="ITEM_CODE"></span>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]