value-of without content of child elements

Here should go questions about transforming XML with XSLT and FOP.
ally
Posts: 2
Joined: Sun Jun 26, 2005 1:55 pm

value-of without content of child elements

Post by ally » Sun Jun 26, 2005 2:03 pm

Hi everybody!

With xslt:value-of I get the content of the actual element and the content of all its child elements. Is there a possibility to get only the content of the actual element without the children's content?

Thanks in advance,
ally

george
Site Admin
Posts: 2100
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Mon Jun 27, 2005 9:47 am

Hi,

In order to get all the text nodes inside an element you need to iterate through them, one possibility will be with something like below, assuming the current node is the desired element:

Code: Select all


<xsl:for-each select="text()">
<xsl:value-of select="."/>
</xsl:for-each>
</code]

Best Regards,
George

Post Reply