Subject:How to print text and nodes text both through a loop ? Author:Vishal Singh Date:10 May 2007 12:24 PM
Suppose the xml is as follows:
<root>
I am here 111.
<outroot>hello</outroot>
<outroot>hello 1</outroot>
I am here 112.
<outroot>hello 2 </outroot>
<Tab>I am not here.</Tab>
<outroot1>I am not here anymore.</outroot1>
<Tab>I am here once again.</Tab>
</root>
How can I print the text() and text in the child nodes in a for-each loop ? Following doesn't works.
<xsl:for-each select="/root or /root/*">
<xsl:value-of select="position()"/> : <xsl:copy-of select="./text()"/>
</xsl:for-each>
My requirement is that I have to copy-of nodes(whether text or tags) until I hit 'Tab' tag. Since I need to treat the 'Tab' and following differently.