RE: Confused using a loop...
> not necessarily, it would be easier just to do > > select="(some/x/path)[position() <= $numberOfItemsToList]"> > > which will just select the first $numberOfItemsToList items. Ah. That does look easier. So, I now have this: ================== <xsl:for-each select="//menuItem[pageID = $pageID]/descendant-or-self::menuItem"> <xsl:sort select="substring(lastUpdate,1,4)" order="descending" /> <!-- year --> <xsl:sort select="substring(lastUpdate,6,2)" order="descending" /> <!-- month --> <xsl:sort select="substring(lastUpdate,9,2)" order="descending" /> <!-- day --> <xsl:for-each select="menuItem[position() <= $numberOfItemsToList]"> <xsl:call-template name="createItem" /> </xsl:for-each> </xsl:for-each> =================== The problem is that my result isn't sorted. I'm a bit confused as to how SORT works. My first select should be selecting all menuItems that are or ar a child of one with a specific pageID. Then, I assume the sort commands sorts that group of selected menuItems. Finally, my second select grabs the first 3 menuItems from that sorted group. But that isn't working, so I'm not quite understanding what's going on there. -Darrel
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