[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Getting rid of namespace attribute under SQL2000 X

Subject: Re: Getting rid of namespace attribute under SQL2000 XML output
From: Francis Norton <francis@xxxxxxxxxxx>
Date: Wed, 17 Apr 2002 19:49:51 +0100
francois rautenbach
Hi Francois,

Francois Rautenbach wrote:

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.

Namespaces aren't just attributes for XML elements, they are in fact the root categories by which elements are grouped.

To get rid of the namespace for an element in XSLT, you need to first match it, then create another element with the same local-name but in a different namespace or none at all.

This kind of thing is easily done using a filter type transform, where you basically copy through, unchanged, everything except the bits you want to alter.

The copy-through bit can be done using what the xslt spec refers to as an "identity transform" -

Here's an example which might help your case:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output indent="yes"/>
<!-- -->
<!-- the "identity" transform - passes stuff through unchanged -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<!-- -->
<!-- for everything except elements in the target namespace -->
<xsl:template match="sql:*" xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
<!-- -->
</xsl:stylesheet>


Cheers -

Francis.


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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.