> 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.

Then XML Spy has a bug.  Modify the match pattern in your template as
follows:

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

Since the svg element in your source file is in the namespace
http://www.w3.org/2000/svg, you must make sure you are matching on the same
namespace.

Dave

Reply via email to