[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: RE: [xsl] Confused using a loop...
From: "Austin, Darrel" <Darrel.Austin@xxxxxxxxxxxxxxxxxx>
Date: Wed, 28 Mar 2007 10:24:46 -0500

> xsl:for-each select="//menuItem[pageID =
> $pageID]/descendant-or-self::menuItem">
>
> That selects a bunch of menu items which may be descendents of each
> other) These were the menu items that you want to process,
> but you don't process them, just their children (if they have
> menuItem children)

Ack! You are right. That's wrong. I actually want to include all the
children AND the parent item. (so, a menuItem that has a child of pageID
= X and all the child menuItems of that menuItem)

So that takes me back to where I started...seems like this is what I
really need:

xsl:for-each select="//menuItem[ancestor-or-self::/menuItem/pageID =
$pageID]"

Though, that, clearly, is not the proper syntax, as it still doesn't
return the parent node (the menuItem that has a pageID = X)

Why is XSL so hard? ;o)

> for each of those you then select $numberOfItemsToList child menuitems
> 	<xsl:for-each select="menuItem[position() &lt;=
> $numberOfItemsToList]"
> You don't sort these at all.
>
> I don't think you want that inner for-each at all do you?

Well, I'm really not sure. I'm not clear on how sort works. I have a
select that grabs a node, I then sort that node, then don't I need to
select the first 3 from that sorted node if I only want to list 3 items?

-Darrel


Current Thread
Keywords
xsl