[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Sort-grouping problem
Hi jeni,
Thank you, I think I know a little more about how sort works... You're currently using xsl:for-each to iterate over the unique dates; why not sort them in the same way as you were before (remembering that the context nodes are Date elements this time rather than News elements)? But.... I think keeping track of context node is exactly my problem. I thought my whole problem was sorting the results, but when I try to make yet another group (within the group by date), I am faced with difficulties (which I hope someone can help me with): Taking my stylesheet below (not sorting it at the moment), I would also want to group by P1 (the XML is at the buttom of the mail). I thought I could do something like this: .. <xsl:for-each select="$unique-dates"> <xsl:variable name="unique-p1s" select=".[not(P1=preceding-sibling::News/P1)]/P1"/> .. but I get the error: Expected token 'eof' found '['. .-->[<--not(P1=preceding-sibling::News/P1)]/P1 --- <xsl:variable name="unique-p1s" select="/NewsList/List/News[not(P1=preceding-sibling::News/P1)]/P1"/> does not give any errors, but will take _all_ P1's, not just those within a given date (unique-dates[n], n>=1) Can anybody can help me with how I go about things like this: what is the context within the <xsl:for-each select="$unique-dates">, how I group within a group (and perhaps within this, the third group..) ? Sincerly Ragulf Pickaxe :)
XML input: <NewsList> <Meta attributeA="AnAttribute"> <One>Just MetaData</One> <Two>Not important here</Two> </Meta> <List> <News NewsType="1"><Date>03-02-2002</Date><P1>This is a newsletter or some such</P1><P2>The News</P2><P3>More News</P3> </News> <News NewsType="2"><Date>03-02-2002</Date><P1>This is a newsletter or some such</P1><P2>The News</P2><P3>More News</P3> </News> <News NewsType="2"><Date>06-02-2002</Date><P1>This is a newsletter or some such</P1><P2>The News</P2><P3>More News</P3> </News> <News NewsType="2"><Date>04-02-2002</Date><P1>This is a newsletter or some such</P1><P2>The News</P2><P3></P3> </News> <News NewsType="2"><Date>05-02-2002</Date><P1>This is a newsletter or some such</P1><P2>The News</P2><P3></P3> </News> <News NewsType="2"><Date>04-02-2002</Date><P1>This is a newsletter or some such</P1><P2>The News</P2><P3>The above P3 tags where empty</P3> </News> <News NewsType="2"><Date>01-02-2002</Date><P1>This is a newsletter or some such</P1><P2>The News</P2><P3>Yet more News</P3> </News> </List> </NewsList> _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|