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

Re: Identity transform (case conversion)

Subject: Re: Identity transform (case conversion)
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Sun, 9 Jul 2006 15:32:02 +0530
xsl xml transforms bound elements
Hi Dimitre,
 Please read my comments below..

On 7/9/06, Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote:
It would really be a nasty bug, in case Mukul got that output.

However, what he got (note the capitalisation) was:

<AUTHOR xmlns:auto-ns1="HTTP://WWW.W3.ORG/XML/1998/NAMESPACE"
xmlns:A="XYZ" xmlns:B="PQR">

Also in the code sample he provided there is no filtering of the "xml"
namespace.

When I write the code for elements as (I have removed capitalization within <test> tag) following:

<xsl:template match="*">
  <xsl:element name="{translate(name(), $small, $caps)}">
    <xsl:variable name="nsHolder">
      <test>
        <xsl:for-each select="namespace::*">
          <xsl:attribute name="{name()}:dummy{position()}"
namespace="{.}"></xsl:attribute>
        </xsl:for-each>
      </test>
    </xsl:variable>
    <xsl:copy-of select="msxsl:node-set($nsHolder)/test/namespace::*"/>
    <xsl:apply-templates select="@*"/>
    <xsl:apply-templates/>
  </xsl:element>
</xsl:template>

I get output:

<?xml version="1.0" encoding="UTF-8"?>
<!-- THIS IS A COMMENT -->
<?PQR X="DO-SOMETHING" ?>
<AUTHOR xmlns:auto-ns1="http://www.w3.org/XML/1998/namespace" xmlns:a="xyz" xmln
s:b="pqr">
<PERSON A:AGE="30" xmlns:A="XYZ"> BY <FIRSTNAME>JANE</FIRSTNAME>
<LASTNAME>DOE</LASTNAME>,
</PERSON>
</AUTHOR>

But when I write the code as (I have now done filtering for
namespaces, with name() = 'xml'):

<xsl:template match="*">
  <xsl:element name="{translate(name(), $small, $caps)}">
    <xsl:variable name="nsHolder">
      <test>
        <xsl:for-each select="namespace::*[not(name() = 'xml')]">
          <xsl:attribute name="{name()}:dummy{position()}"
namespace="{.}"></xsl:attribute>
        </xsl:for-each>
      </test>
    </xsl:variable>
    <xsl:copy-of select="msxsl:node-set($nsHolder)/test/namespace::*"/>
    <xsl:apply-templates select="@*"/>
    <xsl:apply-templates/>
  </xsl:element>
</xsl:template>

I get output:

<?xml version="1.0" encoding="UTF-8"?>
<!-- THIS IS A COMMENT -->
<?PQR X="DO-SOMETHING" ?>
<AUTHOR xmlns:a="xyz" xmlns:b="pqr">
<PERSON A:AGE="30" xmlns:A="XYZ"> BY <FIRSTNAME>JANE</FIRSTNAME>
<LASTNAME>DOE</LASTNAME>,
</PERSON>
</AUTHOR>

i.e., now the namespace http://www.w3.org/XML/1998/namespace is not
getting generated, which I think implies that it is bound to the 'xml'
prefix.

But with the earlier code, URI http://www.w3.org/XML/1998/namespace is
bound to the prefix auto-ns1.

There seems to be a bug somewhere within MSXML4 related to this..

I have tested George's code as well (the <dummy/> example he gave),
with MSXML4. I get the same output as he is getting. So MSXML4 is
generating the namespace http://www.w3.org/XML/1998/namespace bound to
prefix 'xml'.

Regards,
Mukul

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.