|
Subject: [xsl] conditional namespaces From: ronald heller <ronald@xxxxxxxxxxx> Date: Fri, 14 Dec 2001 17:31:52 +0100 |
Consider the following: XML: <document> <title>title</title>
<a>aaa</a> </document>
XSLT: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:variable name="attribute">type</xsl:variable> <xsl:variable name="value">gg</xsl:variable> <xsl:variable name="namespace">http://www.google.com</xsl:variable>
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates />
</xsl:copy>
</xsl:template> <xsl:template match="document">
<document>
<xsl:attribute name="{$attribute}" namespace="{$namespace}">
<xsl:value-of select="$value" />
</xsl:attribute>
<xsl:apply-templates/>
</document>
</xsl:template>OUTPUT: <?xml version="1.0" encoding="UTF-8"?> <document xmlns:ns0="http://www.google.com" ns0:type="gg"> <title>title</title>
<a>aaa</a> </document>
Why are these 0 characters there? We had exspected something like: <?xml version="1.0" encoding="UTF-8"?> <document xmlns:ns="http://www.google.com" ns:type="gg"> <title>title</title>
<a>aaa</a> </document>
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] GUI transformation tools, David Hooker | Thread | Re: [xsl] conditional namespaces, Jeni Tennison |
| [xsl] GUI transformation tools, David Hooker | Date | Re: [xsl] sorting related issue, Sanjay Pandey/Towers |
| Month |