Can anyone tell me how I should copy an entire subtree to a new XML document using Xalan.

My problem

Xml contents:
<IN>
<GRAPH>
<svg:svg xmlns:svg="http://www.w3.org/2000/svg";>
<svg:rect x="0mm" y="0mm" width="5mm" height="15mm" style="fill: red"/>
<svg:rect x="5mm" y="0mm" width="5mm" height="12mm" style="fill: green"/>
<svg:rect x="10mm" y="0mm" width="5mm" height="20mm" style="fill: blue"/>
</svg:svg>
</GRAPH>
</IN>

xsl file

<xsl:template match="IN">
<GRAPH>
<xsl:copy-of select="GRAPH/svg:svg" xmlns:svg="http://www.w3.org/2000/svg"/>
</GRAPH>
</xsl:template>

I want this to produce the same output as the input file. Ofcourse I only simplified the problem,I don't need an exact copy afterwards, but a new result with some copied stuff.
Using Xalan I get an empty GRAPH node. Using XML spy it is fine.


if I use the following xsl I get an exception: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.

<xsl:template match="IN">
<GRAPH>
<xsl:copy-of select="GRAPH/svg" xmlns:svg="http://www.w3.org/2000/svg"/>
</GRAPH>
</xsl:template>

If I want to do a value-of then I have to use
<xsl:value-of select="GRAPH/svg/rect/@x" xmlns:svg="http://www.w3.org/2000/svg"/>


This is not working in XML spy, there again I need to use the following
<xsl:value-of select="GRAPH/svg:svg/svg:rect/@x" xmlns:svg="http://www.w3.org/2000/svg"/>


Can anyone help me producing the exect copy using Xalan? I tried xalan2.4.1 and 2.5.1 already.
Thank you very much


_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail




Reply via email to