Tuesday, 3 September 2013

Which namespace is used for xsl:element when name is an attribute value template

Which namespace is used for xsl:element when name is an attribute value
template

I'm trying to understand how xsl:element works properly and I have this
test transform:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml">
<xsl:template match="test">
<test1/>
<xsl:element name="test2"/>
<xsl:variable name="three" select="3"/>
<xsl:element name="test{$three}"/>
</xsl:template>
</xsl:stylesheet>
When applied to this document:
<?xml version="1.0" encoding="UTF-8"?>
<test/>
I get this result using xsltproc
<?xml version="1.0"?>
<test1 xmlns="http://www.w3.org/1999/xhtml"/>
<test2 xmlns="http://www.w3.org/1999/xhtml"/>
<test3/>
Why is the test3 node not in the same namespace as test1 and test2?

No comments:

Post a Comment