[xsl] Re: Matchin elements in text nodes

Subject: [xsl] Re: Matchin elements in text nodes
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Mon, 22 Jan 2001 01:59:22 -0800 (PST)
Hi Mika,

Apart from using the wrong case ("ARTICLE" instead of "article"),
there's still another problem with the code of your template:

> <xsl:value-of select="text()"/>

will output only the first of the two text node children of the
"article" element in your sample xml source (you may get different
number of text nodes returned, depending on whether/how you use
xsl:strip-space and xsl:preserve-space in your stylesheet).

To get the text of all the text nodes, you may use something like this:

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


mika.borner@xxxxxxxx wrote:

I still have problems.

My sourcefile looks like this:

 <article_date>article date</article_date>
This is the article text part 1
 <sub_heading>sub heading</sub_heading>
The article continues. This is part 2 of it

I tried to match the text node of the article using:

<xsl:template match="ARTICLE">
<xsl:value-of select="text()"/>

The "text()"-pattern doesn't return  anything.

Selecting with "." gives me also the unwanted article_id,main_heading
and the

All I want to select is the direct text node under article (This is the
text part , The article continues. This is part 2 of it)

Can anybody help?

Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices. 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread