[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Finding Any Occurrance

Subject: Re: Finding Any Occurrance
From: Abel Online <abel.online@xxxxxxxxx>
Date: Fri, 01 Sep 2006 20:18:45 +0200
occurrance
Hi Bob,

It'd be informative to know what you mean with "doesn't work". Do you mean that there's no match? Or do you mean that the result is different than from what you expected?

The expression //title will retrieve all the title nodes. Unless all these titles together match your $matcher, you will have a true match (and I think this depends on the XSLT version you use, because in XSLT 1, I think $matcher contains a result tree fragment, which will not match). If what you are after is that the text of the titles should be matched against $matcher, you may try the following:.

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

In which case the test will be true if at least one of the title tags contains the text in $matcher. Perhaps this is even better

<xsl:if test="//title[normalize-space(.) = normalize-space($matcher)]"> ... </xsl:if>

Hope this helps,

Cheers,

Abel Braaksma
http://abelleba.metacarpus.com


Bob Portnell wrote:
(Another baby question, but at least it's on-topic)

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?

(US correspondents, have a great holiday weekend!)

Bob P
simply.bobp@xxxxxxxxx

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.