xsl-list
[Top] [All Lists]

Re: [xsl] Extracting text between nodes

2008-02-13 16:11:50
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/


--~------------------------------------------------------------------
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>
--~--