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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1175)
- Stylus Studio Technical Forum (14546)
-> + Splitting EDIFACT files pipeli... (3)
-> + Problem with SAXO processor - ... (5)
-> + PDF Format Help (4)
-> + License check unreliable (2)
-> - XML related issue (1)
-> + Need help regarding pipeline o... (2)
-> + Error converting XML to EDIFAC... (4)
-> + XSLT Profiling for XSLT 1.0 s... (2)
-> + Grouping (2)
-> - Best Toner for Sensitive Skin (1)
-> + Best Practice for Pipeline err... (2)
-> + pdf generation (4)
-> + Problems excuting a Pipeline w... (2)
-> + XML serializer (3)
-> + Supported EDIFACT versions (5)
-> - Anyone know XActimate ESX file... (1)
-> + Stylus Studio with OpenJDK (2)
-> - Encoding error when importing ... (1)
-> - SEO Service in Delhi, India (1)
-> - HP Printer Support (1)
-- [1-20] [21-40] [41-60] Next
+ Website Feedback (247)
+ XSLT Help and Discussion (7621)
+ XQuery Help and Discussion (1946)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
Mark MaltbySubject: Count funciton
Author: Mark Maltby
Date: 21 Mar 2006 10:23 AM
I need to be able Count text as well as numbers and I can't seem to get either to work.

Also, is it possible to count against the content of another element?

Postnext
Minollo I.Subject: Count funciton
Author: Minollo I.
Date: 21 Mar 2006 10:25 AM
Can you provide a practical example of what you are trying to do?

Thanks,
Minollo

Postnext
Mark MaltbySubject: Count funciton
Author: Mark Maltby
Date: 21 Mar 2006 10:30 AM
Idealy I would like to something along the lines of

<xsl:value-of select="count(/Nodes/Node[text()=someword])" />

Postnext
Minollo I.Subject: Count funciton
Author: Minollo I.
Date: 21 Mar 2006 10:58 AM
That will return you the number of Node elements whose text matches "someword" (provided that "someword" is enclosed in single quotes in that instruction)... what's wrong with it?

Minollo

Postnext
Mark MaltbySubject: Count funciton
Author: Mark Maltby
Date: 21 Mar 2006 11:13 AM
Ah the single quotes was the issue. Thanks

I also need to do a second type of count.
eg

count the amount of items between two node values.

Is this possible? If it isn't, is it possible to count against on node value?

Thanks

Postnext
Minollo I.Subject: Count funciton
Author: Minollo I.
Date: 21 Mar 2006 11:25 AM
>count the amount of items between two node values.
>
>Is this possible? If it isn't, is it possible to count against on
>node value?

These all seem to imply different kind of filters that you would have to specify in the XPath expression...

count(/Nodes/Node[. > 10 and . < 20]) (assuming the value of "Node" is numeric)
count(/Nodes/Node[. = 'some value'])
...

Minollo

Postnext
Mark MaltbySubject: Count funciton
Author: Mark Maltby
Date: 21 Mar 2006 11:41 AM
thats fine but it doesn't work when i want to use values that are dynamic. By that i mean the 10 and 20 are node values and not knwon values i manually enter in

Postnext
Minollo I.Subject: Count funciton
Author: Minollo I.
Date: 21 Mar 2006 11:53 AM
It will work as long as you provide the proper XPath to reach the elements that contain the "dynamic" values you are looking for... something like:

count(/Nodes/Node[../NodeThreshold1 > 10 and /Nodes/MyTopNode < 20])

Postnext
Mark MaltbySubject: Count funciton
Author: Mark Maltby
Date: 21 Mar 2006 12:07 PM
Sorry, maybe I am not explaining this correctly

I need to do this

count(/Nodes/Node[. > NodeThreshold1 and . < NodeThreshold2])

Postnext
Minollo I.Subject: Count funciton
Author: Minollo I.
Date: 21 Mar 2006 12:30 PM
...same concept... you will need to use the proper XPath to reach the dynamic thresholds.

Minollo

Postnext
Mark MaltbySubject: Count funciton
Author: Mark Maltby
Date: 21 Mar 2006 12:54 PM
unfortunately I get the following error when i do the above :

The character '<' cannot be used in an attribute value.

Postnext
Minollo I.Subject: Count funciton
Author: Minollo I.
Date: 21 Mar 2006 03:24 PM
Originally Posted: 21 Mar 2006 03:25 PM
You need to escape it and use &lt;

Posttop
Mark MaltbySubject: Count funciton
Author: Mark Maltby
Date: 22 Mar 2006 07:52 AM
Thanks for ur help. All working now

   
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.