Hi!
I have a problem with the default namespace in XSLT 1.0.
I have a XSLT stylesheet which generates an XML-File. The namespace of the result XML-File depends on an element of the input XML-File.
So for example:
Input XML:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<version>2005</version>
XSLT:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance">
<xsl:element name="manifest">
Then if the version equals to 2005, the default namespace should be set to "http://a" otherwise to "http://b".
Further an attribute of the element should be generated, so:
Code:
<xsl:choose>
<xsl:when test="$version='2005'">
<xsl:attribute name="xmlns:adlcp" namespace="{$xmlns}">http://www.adlnet.org/xsd/adlcp_v1p3</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="xmlns:adlcp" namespace="{$xmlns}">http://www.adlnet.org/xsd/adlcp_v1p2</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
So how can i set the default namespace? Can i set it dynamically in XSLT 1.0? If not, does anybody know another solution?
Thanks!
Geierwally