[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xsl needed: sibilings with different parents

Subject: RE: xsl needed: sibilings with different parents
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 8 Sep 2004 08:36:04 +0100
> ><xsl:for-each select="BB/BB1">
> ><xsl:copy-of
> >select="/root/AA/AA1[/BB/BB1[position()]]"/>
> ></xsl:for-each>
> You are using position() as a standalone expression for a 
> predicate.  All 
> predicates are converted to boolean true()/false() before they are 
> used.  The position() function always returns a positive 
> number, hence will 
> always be converted to boolean true().  This qualifies all 
> BB1 children of 
> BB that may be present.

Ken is right that [position()] won't work, but he hasn't explained the
reason very clearly. Any predicate that is the numeric value [N] is treated
as shorthand for [position()=N], so the predicate [position()] is short for
[position()=position()] which of course is always true.

Generally speaking, any operation involving combining or comparing two
node-sets needs variables, except for a limited class of joins that can be
handled using the implicit existential semantics of operators like "=".
Perhaps someone better versed in predicate logic than I am can explain why
this is true.

Michael Kay

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.