xsl-list
[Top] [All Lists]

Re: [xsl] Matching for strings...

2006-09-06 08:50:35

Well, the Cookbook didn't help with this problem, or at least not that
I saw.

Most books (Apart from MK's) are XSLT1 (which is still the official
version) but you appear to be using XSLT2 draft.


I want to find <program> elements whose <title> or <subtitle> or
<description> might contain the string I've stowed in the variable
$target.
<xsl:if test="matches(normalize-space(//tv:program),$target)">

do you mean contains (for which the contains() function would be most
natural, or equal (when you could use =) or does $target contain a
regular exprression not a fixed string (in which case you would use
matches())

on the face of it I'd guess you'd want

program[contains(title,$target) or contains(subtitle,$target)]

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

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