| Subject: Re: [xsl] Identity transform (case conversion) From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx> Date: Sun, 9 Jul 2006 15:32:02 +0530 | 
Hi Dimitre, Please read my comments below..
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><?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><?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.
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 | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| Re: [xsl] Identity transform (case , George Cristian Bina | Thread | Re: [xsl] Identity transform (case , Dimitre Novatchev | 
| Re: [xsl] Identity transform (case , George Cristian Bina | Date | Re: [xsl] Identity transform (case , Dimitre Novatchev | 
| Month |