Subject: RE: Extracting text between nodes
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 14 Feb 2008 09:45:05 -0000
|
> My original reply was compatible with 1.0 as well --
>
> <xsl:template match="a | b[position() = 1]"/>
>
> 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.
Both this solution and David Carlisle's handle the example posted, but
neither of them reflect the specification:
I want to extract only the text between the first <br/> tag and the last <a>
anchor tag
which is what I tried to do in my XSLT 2.0 solution.
It's quite possible to achieve that in XSLT 1.0 as well, but it's not much
fun, so I certainly won't attempt it unless there is a clearer statement of
the problem.
Michael Kay
http://www.saxonica.com/
|