RE: xsl needed: sibilings with different parents
> ><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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format