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

Wah? Weird... Clarifying the Schema

Subject: Wah? Weird... Clarifying the Schema
From: Michael <msell@xxxxxxxxxxxxxxx>
Date: Thu, 28 Oct 2004 12:21:34 +1000
schema wah wah
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>


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.