[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Identity transform (case conversion)


Subject: Re: [xsl] Identity transform (case conversion)
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Sun, 9 Jul 2006 07:19:52 -0700

Thank you, Mukul.

Now I can confirm that the result reported by you is produced by
MSXML3, MSXML4 and MSXML6.

--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.



On 7/9/06, Mukul Gandhi <gandhi.mukul@xxxxxxxxx> wrote:
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




--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.


Current Thread