[Home] [By Thread] [By Date] [Recent Entries]
Thanks Dimitre for the clarifications..
Here is the code which doesn't work fine with MSXML4. This stylesheet: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes="msxsl"><xsl:output method="xml" indent="yes" encoding="UTF-8" /> <xsl:variable name="small" select="'abcdefghijklmnopqrstuvwxyz'" /> <xsl:variable name="caps" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" /> <xsl:template match="*">
<xsl:element name="{translate(name(), $small, $caps)}">
<xsl:variable name="nsHolder">
<test>
<xsl:for-each select="namespace::*">
<xsl:attribute name="{translate(name(), $small,
$caps)}:dummy{position()}" namespace="{translate(., $small,
$caps)}"></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> <xsl:template match="text()">
<xsl:value-of select="translate(., $small, $caps)" />
</xsl:template> <xsl:template match="@*">
<xsl:attribute name="{translate(name(), $small, $caps)}"
namespace="{translate(namespace-uri(), $small, $caps)}"><xsl:value-of
select="translate(., $small, $caps)" /></xsl:attribute>
</xsl:template> <xsl:template match="processing-instruction()">
<xsl:processing-instruction name="{translate(name(), $small,
$caps)}"><xsl:value-of select="translate(., $small, $caps)"
/></xsl:processing-instruction>
</xsl:template> <xsl:template match="comment()">
<xsl:comment><xsl:value-of select="translate(., $small, $caps)"
/></xsl:comment>
</xsl:template></xsl:stylesheet> When applied to this XML: <?xml version="1.0" ?> <!-- this is a comment --> <?pqr x="do-something" ?> <author xmlns:a="xyz" xmlns:b="pqr"> <person a:age="30"> by <FirstName>Jane</FirstName> <LastName>Doe</LastName>, </person> </author> produces 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" xmlns:B="PQR"> <PERSON A:AGE="30"> BY <FIRSTNAME>JANE</FIRSTNAME> <LASTNAME>DOE</LASTNAME>, </PERSON> </AUTHOR> Regards, Mukul On 7/8/06, Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote: > Why at all the namespace, http://www.w3.org/xml/1998/namespace is part > of node-set namespace::*. I am not sure, but does it relate to the XML > Namespaces spec? (you hinted this in your previous answers) >
|

Cart



