Re: [xsl] Delimited string-value of elements / text nodes with XSLT 1.0?

Subject: Re: [xsl] Delimited string-value of elements / text nodes with XSLT 1.0?
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Sun, 19 Nov 2006 20:52:21 -0800
Use:

	<xsl:template match="text()">
	  <xsl:value-of select="concat(., ' ')"/>
	</xsl:template>


-- Cheers, Dimitre Novatchev --------------------------------------- Truly great madness cannot be achieved without significant intelligence. --------------------------------------- To invent, you need a good imagination and a pile of junk ------------------------------------- You've achieved success in your field when you don't know whether what you're doing is work or play


On 11/19/06, B. S. <sbremal@xxxxxxxxxxx> wrote:
Hi,

This is a snippet of my input XHTML whose /html/body part needs to be
extracted as text.

...
<b>hello1<p>hello2</p>hello3<p>hello4</p>hello5</b>
...

I would like to get this INCLUDING the spaces:

hello1 hello2 hello3 hello4 hello5

The only problem is that XSLT 1.0's value-of concatenates everything under
/html/body WITHOUT allowing me to specify delimiter.

Is there any way to do this? (I'm using xsltproc with HTML input so XSLT 2.0
wouldn't be ideal...)

Do I need something recursive here? Note that the depth of the tree is
unknown just like the order of text nodes and element nodes.

Cheers,
Balazs

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now!
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

Current Thread