xsl-list
[Top] [All Lists]

Re: [xsl] Matching for strings...

2006-09-06 10:27:11
Bob,

Was it someone else who asked something very closely analogous to this just a week or two ago?

In any case,

At 11:35 AM 9/6/2006, you wrote:
I want to find <program> elements whose <title> or <subtitle> or
<description> might contain the string I've stowed in the variable
$target. Something simple like

<xsl:if test="matches(normalize-space(//tv:program),$target)">

fails, since the first argument wants to be a node, not a sequence.

Right. When they try this sort of thing people generally want

<xsl:if test="//tv:program[matches(normalize-space(),$target]">

which tests true if such a node exists.

An optimized processor, I assume, will return true as soon as it finds one such node. A naive one will examine all of them before returning true.

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>