Re: [xsl] Extracting text between nodes

Subject: Re: [xsl] Extracting text between nodes
From: "Sam Byland" <shbyland@xxxxxxxxxxx>
Date: Wed, 13 Feb 2008 21:12:59 -0500
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?



My original reply was compatible with 1.0 as well --


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:output method="text"/>

<xsl:template match="a | b[position() = 1]"/>

</xsl:stylesheet>


Which, as David noted in his post, will "lose the stuff you don't want". There are many ways to do this though, and it will depend on how the HTML will vary from the example you provided. i.e., do you only (and always) want to lose the text in the first <b> element, and all <a> elements?


...sam

Current Thread