[xsl] xtvd grouping problem (I think)

Subject: [xsl] xtvd grouping problem (I think)
From: "Bob Portnell" <simply.bobp@xxxxxxxxx>
Date: Fri, 8 Sep 2006 13:41:50 -0700
I don't have the XSLT vocabulary for this, so I'll try to explain it
in English as best I can. Where I'm insufficiently clear about the
data, one could look at http://tmsdatadirect.com/docs/tv/ for the XTVD
schema or a sample file.

My project takes an xtvd data file as input and 'filters' it against
desired items in an XML 'watch list' of goodies I want to see but
don't have to want to page through the magazine or newspaper
supplements to find. It's doing this very well presently, with one
small snag: I'd like items matching in each "search item" to report
out in time order. It's almost doing this, but not quite. Let me
explain a little deeper:

Each <program> has its own @id. A <program> will air at least once,
and possibly several times, so there will be at least one <schedule>
(and maybe more) which cite that program's @id (as its @program
attribute). Each <schedule> also has an @time and @duration.

The XSLT presently does this:
   for each search item
       find the set of programs which have that item
       for each program in the set
           sort by time
           report the pertinent show information.

The catch is that each <program> item represents a different "episode"
in a series. So by the time I get down to reporting... well, it's not
putting them all in time-order, but it is getting multiple broadcasts
of a single episode in time-order correctly. I think what I need is...

   for each search item
       find the set of programs which have that item
       convert this to the set of schedule items which have those programs
       for each in the schedule set
           sort by time
           report the show information.

Whew! Thanks for bearing with me through all this discussion. I can
now ask my question.

Given a variable $progSet which has a bunch of <programs> in it, how
do I define a $schedSet which has only <schedule> items containing
@program ids from $progSet?

I've gotten as far as
<xsl:variable name="schedSet" select="//schedule[@program . . {sound
of screeching brakes}? />

Please excuse where I've strayed from proper XSLT vocabulary; I hope
my intent is clear enough despite such lapses of inexperience.


Bob Portnell

Current Thread