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

Matching for strings...

Subject: Matching for strings...
From: "Bob Portnell" <simply.bobp@xxxxxxxxx>
Date: Wed, 6 Sep 2006 08:35:31 -0700
datadirect tv
Well, the Cookbook didn't help with this problem, or at least not that I saw.

So, my data (in part) is like this..

<xtvd>
   ...
   <programs>
       <program id@="...">
           <title> ... </title>
           <subtitle> ... </title>
           <description ... </title>
           ...
       </program>
       <program>
       ...
       </program>
       ...
   </programs>
   ...
</xtvd>

(Yes, it's the ever-popular DataDirect TV listings from Tribune Media
Services... I'm working with the data in its "native" xtvd structure,
rather than doing the very long-winded transform to the more popular
XMLTV structure.)

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. I
can't think of any better solution than looping through all the
programs, looking inside, but with several thousand programs and
several keywords to process ... I hope someone here can see a better
way!

Would it be possible to do this with a key? For example,

<xsl:key name="$target" match="(//title[matches(.,$target)]) or
(//subtitle[matches(.,$target)]) or
(//description[matches(.,$target)])" use="../@id" />

Gee, that looks promising. Must be something wrong with it. I'll try
it. Meanwhile, happy to hear other advice!

Bob Portnell
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.