xsl-list
[Top] [All Lists]

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

2007-03-28 08:25:07
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

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