<h1>The Title</h1> <p>Paragraph 1.</p> <p>Paragraph 2.</p>
You get:
The TitleParagraph 1.Paragraph 2.
I think you might be stripping whitespace nodes? If you would turn this off you should get:
The Title Paragraph 1. Paragraph 2.
OK, I misstated how the content is. In this case the XHTML is generated with xsl:output/@indent='no' -- it also has a xsl:strip-space/@elements='*'. We have to do this for some sites because some of them render incorrectly with spacing left in (the one I am indexing in particular) -- not optimal, but... So it actually looks like:
<h1>The Title</h1><p>Paragraph 1.</p><p>Paragraph 2.</p>
Sorry for not being clear upfront. So in general, what you have said would work fine, thanks for your help,
-Rob
I wonder if this method would be more useful in general if spaces (or some other separator) were inserted between text nodes. Although, then it would not be an exact representation of the text. But I can't see the use of it any other way. What do you think? How are people using Element.getStringValue()?
I think this is there to give you exactly the same functionality as with the xsl:value-of element in xslt. (in both cases, you are depending on the whitespace defined in the XML document)
There is also the String Node.valueOf( String xpath) method you could use instead (should give a similar result).
Regards, Edwin
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ dom4j-user mailing list dom4j-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-user