xsl-list
[Top] [All Lists]

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

2006-11-19 21:52:44
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(_at_)hotmail(_dot_)com> 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/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--