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

Re: intersection puzzle

Subject: Re: intersection puzzle
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 6 Apr 2005 10:50:19 +0100
star of david number puzzle
Your post is unclear as to whetjer you are trying to find teh
intersection based on node identity ie find thoe nodes that are in both
node sets or to find those nodes in one node set have the same value for
some definition of value) as some other node in a different node set.

  <xsl:variable name = "intersection" select ="$polo[count(. | $marco) = 
  count($marco )] " />
  This is successful, but I don't see a good way to manipulate the 
  individual attributes (again, to add 1 to a value to find nodes with 
  neighboring values).

This is based on node identity, so you are testing if the _same_ node
appears in each set, not just whether nodes with the same values appear.


  <xsl:variable name = "intersection" select = "$polo/square[ @h 
  =$marco/square/@h and @v = $marco/square/@v ] " />

This is a completely different beast it is comparing values: you want to
count two nodes as the same if they have the same h and v attributes.
It doesn't work as you are selecting different  $marco/square elements
within the predicate.  I don't think you can do this test with a single
XPath1 expression.


  <xsl:variable name = "intersection" select = "$polo/square[@h = 
  $marco/square/@h + 1 and @v = $marco/square/@v ] " />
  that code doesn't behave anything like the example it is based on.

@h = $marco/square/@h 
is a test of node-set = node set
so is true if any node in the first set has teh same string value as any
node in the second.

@h = $marco/square/@h +1

is a test of node-set = number so is true if the string value of the
first (only in this case) node in @h, after being coerced to a number is
equal to the number.

the number in question is the numerical value of $marco/square/@h +1
which is obtained by adding 1 to the numerical value of
$marco/square/@h whenever a node-set is used in a numeric or string
context the string value of the first node in document order is used,
and the other nodes are discarded.

David


________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.