xsl-list
[Top] [All Lists]

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

2007-03-28 07:58:35
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() &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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--