|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Wah? Weird... Clarifying the Schema
I've come across the strangest thing, and I'm trying to figure out why
it occurs. I was hoping someone would enlighten me onto what is going on
here:
I'm a recent member to the XSLT scene, so don't completely understand how the schema works to a full extend (i'm learning... slowly (grin)). Anyway, recently i've been playing around with some code that increments through each book in a catalog, and displays each book category from the catalog in a drop down box. To do this I decided to sort the catalog, incrementally go through each book node, then call a conditional statement that would only fire off if the previous node had a category that was different. The weirdest thing happens here. Firstly, it has come to my attention that the 'preceding-sibling' axis is not effected by an 'xsl:sort' element. This is proved when removing the 'xsl:sort' element completely. The weird thing is that the code WORKS!!! So, i'm hoping I can get some clarification on this.... Why is the code working? <xsl:for-each select="catalog/book"> <xsl:sort select="category" data-type="text" order="ascending" /> <xsl:if test="not(preceding-sibling::book/category = category)"> <xsl:choose> <xsl:when test="category = $category"> <option value="{category}" selected="true"><xsl:value-of select="category" /></option> </xsl:when> <xsl:otherwise> <option value="{category}"><xsl:value-of select="category" /></option> </xsl:otherwise> </xsl:choose> </xsl:if> </xsl:for-each>
|
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
|

Cart








