xsl-list
[Top] [All Lists]

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

2007-03-28 08:43:19
the idiom you want is

<xsl:for-each select="/an/x/path"/>
<xsl:sort selct="relative/path/to/sort/key"/>
<xsl:if test="position() &lt; 4">
  do something
</xsl:if>
</xsl:for-each>

And that solves my other issue! THANKS! So, this is what I ended up
with:

        <xsl:for-each
select="//menuItem[ancestor-or-self::menuItem/pageID = $pageID]"> 
                <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:if test="position() &lt; $numberOfItemsToList">
                        <xsl:call-template name="createItem" />
                </xsl:if>
        </xsl:for-each>

This appears to be working. Thanks everybody!

-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>
--~--