xsl-list
[Top] [All Lists]

Re: [xsl] Finding Any Occurrance

2006-09-01 12:53:22
Bob,

We need to know more....

At 01:31 PM 9/1/2006, you wrote:
I have (successfully!) pulled some content from an outside file (and
hidden it in the variable $matcher). I now want to look through my
input file to see if that content is in any <title> child, anywhere,
so I know if it's worth carrying on processing for this content. But

<xsl:if test="//title = $matcher">

doesn't work. What have I overlooked?

By "that content is in any title child, anywhere", do you mean the string value of $matcher equals the string value of any title? Your equality test should check that.

If you mean "the value of matcher is a substring of the value of any title anywhere", you'll have to be more creative:

if test="//title[contains(.,$matcher)]"

tests true if there exists any title node whose string value contains the string value of $matcher.

Remember that whitespace in your title values, or in $matcher, can throw this off too ... in which case the normalize-space() function comes to the rescue.

Ask again if this isn't enough to get you there.

Cheers,
Wendell


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

<Prev in Thread] Current Thread [Next in Thread>