[xsl] Getting rid of namespace attribute under SQL2000 XML output

Subject: [xsl] Getting rid of namespace attribute under SQL2000 XML output
From: "Francois Rautenbach" <xsl@xxxxxxxxxx>
Date: Wed, 17 Apr 2002 19:48:01 +0200
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


Current Thread