Re: [xsl] Extracting text between nodes

Subject: Re: [xsl] Extracting text between nodes
From: Liron <magilam@xxxxxxxxxxxxxxxx>
Date: Thu, 14 Feb 2008 01:11:04 +0200
Hi,

Thank you for the reply.

Unfortunately, this line doesn't work under my xslt engine (libxslt under PHP). I guess it only supports 1.0
Any ideas?


btw: I need this transformation because the source html contains lots of text under one node which also has child nodes.
The only way to extract the relevant data is to get all the text between two elements which are certain delimiters for the desired text.


Thank you

In 2.0, assuming <font> is the context node, I think the most direct
translation of your requirement is

.//text()[. >> current()/br[1] and . << current()/a[last()]]

Note that this gives you a sequence of text nodes, if you want to turn this
into a string, use string-join(). Remember to escape < with &lt;


But I do wonder how general-purpose this is; are there lots of instances
like this, and do they vary much?

Michael Kay
http://www.saxonica.com/

Current Thread