Re: [xsl] Conditional extraction of data

Subject: Re: [xsl] Conditional extraction of data
From: Geert Josten <Geert.Josten@xxxxxxxxxxx>
Date: Mon, 08 Nov 2004 15:41:42 +0100
M. David Peterson wrote:

ooops!

This portion:

<xsl:value-of select="foo"/> will output: "this is the value of foo"

<xsl:value-of select="foo"/> will output a copy of all the text elements as well as the elements and there values that are descendants of foo. o

should have read...

<xsl:value-of select="foo"/> will output: "this is the value of foo"

Not true. xsl:value-of takes the first element from the node-set that results from the expression "foo" and converts that to a string. As both sub elements <bar> and <p> are _inside_ element <foo>, their textual content is returned as well.


The output is therefore: "
   this is the value of foo
   this is the value of bar.this is the value of a paragraph that is the child of bar
"

(including new-lines when white-space is preserved)

<xsl:copy-of select="foo"/> will output a copy of all the text elements as well as the elements and there values that are descendants of foo.

Sorry for the confusion!

<M:D/>

Grtz, Geert

Current Thread