xsl-list
[Top] [All Lists]

RE: [xsl] Help! How do I find elements through text contents XSLT 1.0

2008-01-24 06:56:58
Thanks David, 

that reduces the number of permutations but doesn't solve the problem of
multiple levels. That is, I sometimes have extra <b> and <i> tags. Someone
used <tbody> where most did not. I'm looking for an easy way of getting to
the text() node at the end of a largely unknown path. The only thing I can
say for certain is that it is a table.

With further dabbling, I appear to have stumbled on a solution:

<template match="body/table">
        <xsl:choose>    
                <xsl:when test="contains(.,'Keyword')">

This looks through the whole table to find 'Keyword' irrespective of the
element names and returns true if it is found.

Richard

-----Original Message-----
From: David Carlisle [mailto:davidc(_at_)nag(_dot_)co(_dot_)uk] 
Sent: 24 January 2008 12:51
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Help! How do I find elements through text contents XSLT
1.0


"contains(tr[1]/th[1],'Keyword')">
"contains(tr[1]/td[1],'Keyword')">


since a tr can/should only have td or th and you don't mond which it is, you
can probably just use 8
                

        <xsl:when test="contains(tr[1]/*[1],'Keyword')">

to do both cases at once.

David


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