| Subject: [xsl] Matching for strings... From: "Bob Portnell" <simply.bobp@xxxxxxxxx> Date: Wed, 6 Sep 2006 08:35:31 -0700 | 
<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
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!
<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 | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| RE: [xsl] Migration from XSLT1.0 to, Michael Kay | Thread | Re: [xsl] Matching for strings..., andrew welch | 
| RE: Re: [xsl] Petri net to BPEL mod, cknell | Date | Re: [xsl] Matching for strings..., andrew welch | 
| Month |