xsl-list
[Top] [All Lists]

Re: Exclude by Sibling Condition

2005-12-02 11:43:23
On Fri, 2 Dec 2005 08:45:47 -0600
JBryant(_at_)s-s-t(_dot_)com wrote:

<xsl:for-each select="page[not(@tab=following::page/@tab)]">
  <!-- Process the nodes you selected here -->
</xsl:for-each>

From a human readability point of view, that's three lines shorter and 
keeps the selection syntax in the for-each, so that the interior of the 
for-each is purely how to process a node that matched the selection 
criteria. So, to me, that's cleaner and easier to follow.

Indeed. Actually I didn't consider your method because it selects:

  <page name="p2" tab="products"/>
  <page name="d" tab="downloads"/>
  <page name="s" tab="support"/>

Rather than:

  <page name="p0" tab="products"/>
  <page name="d" tab="downloads"/>
  <page name="s" tab="support"/>

But looking closer I can see that simply replacing 'following' with
'preceding' appears to generate the above correctly.

Thanks,
Mike

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



<Prev in Thread] Current Thread [Next in Thread>