XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Mark MaltbySubject: Count on 2 node sets
Author: Mark Maltby
Date: 16 May 2006 10:57 AM
Is it possible to do a concatenative count on two sets of nodes?

Postnext
Minollo I.Subject: Count on 2 node sets
Author: Minollo I.
Date: 16 May 2006 11:18 AM
If I well understand what you mean, yes. You can do something like:

count(//seniorEngineer/@salary | //juniorEngineer/@salary)

...to compute the total of all salaries for both junior and senior engineers.

Postnext
Mark MaltbySubject: Count on 2 node sets
Author: Mark Maltby
Date: 16 May 2006 11:26 AM
<xsl:value-of select="count(Nodes/Node/x and Nodes/Node/y)"/>

Whilst tring to do the above i get a error:

Value of expression cannot be converted to a node-set in value-of

All i want to achieve is a count of when both x and y are both present

Postnext
Minollo I.Subject: Count on 2 node sets
Author: Minollo I.
Date: 16 May 2006 11:41 AM
Try
<xsl:value-of select="count(Nodes/Node/x | Nodes/Node/y)"/>

Postnext
Mark MaltbySubject: Count on 2 node sets
Author: Mark Maltby
Date: 16 May 2006 11:43 AM
isn't pipe "or"

Postnext
Tony LavinioSubject: Count on 2 node sets
Author: Tony Lavinio
Date: 16 May 2006 11:56 AM
Originally Posted: 16 May 2006 11:47 AM
Well, pipe is 'union'. It means to count any nodes that are in this set
or in that set. (That is, one or the other or both - it's kind of like
an or, but not quite.)

Postnext
Mark MaltbySubject: Count on 2 node sets
Author: Mark Maltby
Date: 16 May 2006 11:51 AM
And is what i need then. Please see my second message where I get the error

Postnext
Mark MaltbySubject: Count on 2 node sets
Author: Mark Maltby
Date: 16 May 2006 12:23 PM
if i have 2 'x' nodes and 4 'y' nodes i want my result to return 2 and not 4.

Is this possible?

Posttop
Minollo I.Subject: Count on 2 node sets
Author: Minollo I.
Date: 16 May 2006 12:57 PM
Running XSLT 2.0 or XQuery, you may be able to use "intersect": http://www.w3.org/TR/xpath20/#combining_seq

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.