Hi
I have created two flavors of an XSLT stylesheet to transform all attributes
of an XML document to elements:
They both work as expected with MSXML and XMLSPY but throw an exception
=========================
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="iso-8859-1"
indent="yes"/>
<xsl:template match="*">
<!-- copy of the element itself -->
<xsl:copy>
<!-- handle all child nodes plus
attributes -->
<xsl:apply-templates select="node() |
@*"/>
</xsl:copy>
</xsl:template>
<!-- template for copying over text, comment and pi nodes -->
<xsl:template match="text() | comment() |
processing-instruction()">
<xsl:copy/>
</xsl:template>
<!-- template for converting attributes to elements -->
<xsl:template match="@*">
<xsl:element name="{local-name()}"
namespace="{namespace-uri()}">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
=========================
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="iso-8859-1"
indent="yes"/>
<xsl:template match="*">
<!-- copy of the element itself -->
<xsl:copy>
<!-- converting attributes to
elements -->
<xsl:for-each
select="attribute::node()">
<xsl:element
name="{local-name()}" namespace="{namespace-uri()}">
<xsl:value-of
select="."/>
</xsl:element>
</xsl:for-each>
<xsl:apply-templates select="node()" />
</xsl:copy>
</xsl:template>
<!-- template for copying over text, comment and pi nodes -->
<xsl:template match="text() | comment() |
processing-instruction()">
<xsl:copy/>
</xsl:template>
</xsl:stylesheet>
=========================
The problem is that the local-name() function always returns an empty string
which results in the error message
'' is an invalid QName
Is this a bug in the framework?
Jim