RE: [xsl] Confused using a loop...

Subject: RE: [xsl] Confused using a loop...
From: "Austin, Darrel" <Darrel.Austin@xxxxxxxxxxxxxxxxxx>
Date: Wed, 28 Mar 2007 09:58:10 -0500
> not necessarily, it would be easier just to do
>
> select="(some/x/path)[position() &lt;= $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() &lt;=
$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

Current Thread