preceding-sibling with sorted for-each

Subject: preceding-sibling with sorted for-each
From: felix@xxxxxxxxxxxxxxxxxxxxxx
Date: Wed, 15 Mar 2000 16:00:02 +0100
Hi,

I want to make a table out of a sorted tree. My data looks like this:

<root>
 <movie title="One">
  <date cinema="super" days="1-4" row="1"/>
 </movie>
 <movie title="Two">
  <date cinema="test" days="6-7" row="1"/>
 </movie>
 <movie title="Three">
  <date cinema="super" days="5" row="1"/>
  <date cinema="test" days="1-7" row="2"/>
 </movie>
</root>

The table should let span the movies over the columns according to
their position in date/@days and they should get in date/@row row. All
other tableentries should get a &nbsp; (and preferably do a colspan
too).
I tried to achieve this by sorting the nodes by the attributes days
and row. But I can't decide wether the actual movie is in the same row
as the last one, since I can't access the sorted preciding movie.
I get a sorted list of the movies with this: 

<xsl:for-each select="movie/date[@cinema='super']">
 <xsl:sort select="@row" data-type="text" order="ascending"/>
 <xsl:sort select="@days" data-type="text" order="ascending"/>
 <xsl:value-of select="../@title/>
</xsl:for-each>

Now I want to get the (sorted) preceding (and following) movie with 
something like:

parent::node()/preceding-sibling::movie[1]

The problem with the parent:: thing is, that it operates on the
unsorted original data. So I tried to put the node-fragments I got in
a variable, but I can't access the nodes afterwords anymore.

How can I achieve that? Or alternatively, How can I change a variable-string
into a node-set? (I have tried to output the sorted movies in a
variable with 

<xsl:variable name="tree">
<xsl:for-each select="movie/date[@cinema='super']">
 <xsl:sort select="@row" data-type="text" order="ascending"/>
 <xsl:sort select="@days" data-type="text" order="ascending"/>
 <xsl:copy-of select="..>
</xsl:for-each>
</xsl:variable>

, but when I try to access it with something like $tree/movie it
fails.

Thanks for your attention.
Felix Schumacher


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread