Link to home
Start Free TrialLog in
Avatar of sanjeev_mca
sanjeev_mca

asked on

How to get Full XML in a xsl:variable

Hi Experts,

 I have an xml as :

<Test>
 <TestNode1 name="node1"> This is test node 1</TestNode1>
 <TestNode2 name="node2"> This is test node 2</TestNode2>
</Test>

My Question :

 Is this possible to get this XML in a xsl:variable ?

 When I use <xsl:variable name="nodes" select="/"/> it gives me just the contents not the nodes.

Thanks!
Sanjeev
Avatar of zc2
zc2
Flag of United States of America image

It should be no problem. It works fine at least in MSXSL:
<xsl:variable name="nodes" select="/"/>
<xsl:for-each select="$nodes/Test/*">
<xsl:value-of select="name()"/> - <xsl:value-of select="."/>,
</xsl:for-each>

Open in new window

Avatar of sanjeev_mca
sanjeev_mca

ASKER

That's true, but when i pass this variable to a Java method, it looses its tags and only contents are passed.
ASKER CERTIFIED SOLUTION
Avatar of zc2
zc2
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial