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

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
xsl for each preceding sibling
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

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.