xsl-list
[Top] [All Lists]

RE: [xsl] Extracting text between nodes

2008-02-14 02:45:37
 
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/



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