Altova Mailing List Archives
>xsl-list Archive Home
>Recent entries
>Thread Prev -
>Thread Next - Re: preceding-sibling with sorted for-each
preceding-sibling with sorted for-each
To:
Date: 3/15/2000 5:00:00 PM
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 (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
Disclaimer
These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

