Re: [xsl] What's wrong with my ancestor syntax?

Subject: Re: [xsl] What's wrong with my ancestor syntax?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 26 Mar 2007 23:59:20 +0100
	<xsl:for-each select="*/menuItem[ancestor-or-self::pageID =
$pageID]"> 

that selects menuItem's that have an ancestor, or are a pageID element
with the supplied value, but clearly a menuItem is never a pageID and
looking at your input I don't think it ever as pageID has ancestor.

I think you want to know if the current eleemnt or ancestor has a pageID
child, so that's

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

or just coming down rather than going down and up each time:

	<xsl:for-each select="*/menuItem[pageID = $pageID]/descendant-or-self::menuItem"> 

David

Current Thread