[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Finding Any Occurrance


Subject: Re: [xsl] Finding Any Occurrance
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 01 Sep 2006 15:49:12 -0400

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


Current Thread