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

Re: would like to simplify my XSLT

Subject: Re: would like to simplify my XSLT
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 30 Jan 2007 15:06:07 GMT
Re:  would like to simplify my XSLT
> Which, makes me wonder in what scenario's 'intersect' can be useful.

when you want to know if a node is in two different sets.
for example suppose you have a key that returns some nodes
key('x','a')
and some more nodes
key('x','b')
now, which modes are returned by both a and b. You can do this in xslt1
as
key('x','a')[count(key('x','b'))=count(.|key('x','b'))]
but it's rather more readable to say
key('x','a') intersect key('x','b')



> Yes. And that is basically what many of us showed in response to the OP. 
> But don't you find '$1 intersect $2' much more readable than
> '$1[.=$2]'? 

Not much but then I've been using xpath1 for a long time, perhaps my
senses are corrupted:-)

> (if automatic node-to-value were applied for intersect).
That woudl get very confusing, especially for text nodes (which many
people use interchangeably with strings). You want it to be clear in the
syntax wheter you are doing identity-equality (so two nodes are ony
equal if they are the same node, or value-equality, where two items are
equal if they have the same string value.

David

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-2011 All Rights Reserved.