Can you please clarify on how to eliminate xsl:namespace in the example I've
provided?
If we take your code and expand it into a full example, it could look like this:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:output indent="yes"/>
<xsl:template name="start">
<xsl:variable name="value" as="xs:QName"
select="QName('http://www.xmlplease.com', 'jt:YES')"/>
<element value="{$value}">
<xsl:namespace name="{prefix-from-QName($value)}"
select="namespace-uri-from-QName($value)"/>
</element>
</xsl:template>
</xsl:stylesheet>
It works nicely but it is easy to do without xsl:namespace:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:output indent="yes"/>
<xsl:template name="start">
<xsl:variable name="value" as="xs:QName"
select="QName('http://www.xmlplease.com', 'jt:YES')"/>
<element value="{$value}" xmlns:jt="http://www.xmlplease.com"/>
</xsl:template>
</xsl:stylesheet>
Or even this:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jt="http://www.xmlplease.com">
<xsl:output indent="yes"/>
<xsl:template name="start">
<xsl:variable name="value" as="xs:QName"
select="QName('http://www.xmlplease.com', 'jt:YES')"/>
<element value="{$value}"/>
</xsl:template>
</xsl:stylesheet>
It is for that reason that the examples of Vladimir, Florent, MK and
the spec are not as good as they can be. They are not a raison d'être
for a new xsl:namespace element in XSLT 2.0.
I have provided two examples where xsl:namespace is necessary.
Cheers,
Jesper Tverskov
http://www.xmlkurser.dk
http://www.xmlplease.com
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--