SV: [thelist] Simple XPath question

Marcus Andersson marcan at home.se
Mon Nov 10 18:18:32 CST 2003


>I'm transforming the para with:

<xsl:template match="para">
	<p><xsl:value-of select="."/></p>
</xsl:template>

When using <xsl:value-of select="."/> you only select the textual
content of para to output. You can try the following to get all content
for para:

<xsl:template match="para">
	<p><xsl:copy-of select="node()"/></p>
</xsl:template>

By doing this you will copy all child nodes of para to the result tree
(all text nodes, child elements etc.). If you want to make sure that you
only copy elements and text you can use <xsl:copy-of select="*|text()"/>
instead.

/Marcus

Ps. There is an excellent FAQ for XSL at
http://www.dpawson.co.uk/xsl/xslfaq.html and an equally excellent
mailing list for XSL at mulberrytech.com (where you find a lot of XSL
book and spec authors)



More information about the thelist mailing list