473,405 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

xslt: count elements...

Hello!

i want to count elements in xslt.
All with meta=13 contains a AND meta 14 contains b
but it dont work any Idee why?
Thanks.
i try it with
count(object/node[@meta='27']/data[(@meta='13' and contains(.,'a'))
and (@meta='14' and contains(.,'b'))])

but always its zero.

my xml:

<object>
<node meta="27" >
<data meta="13" >a</data>
<data meta="14" >b</data>
<data meta="15" >c</data>
<data meta="16" >d</data>
</node>

<node meta="27" >
<data meta="13" >a</data>
<data meta="14" >b</data>
<data meta="15" >c</data>
<data meta="16" >d</data>
</node>
<node meta="27" >
<data meta="13" >s</data>
<data meta="14" >b</data>
<data meta="15" >c</data>
<data meta="16" >d</data>
</node>
</object>

Dec 9 '05 #1
4 6941
ra*****@gmx.de schrieb:
Hello!

i want to count elements in xslt.
All with meta=13 contains a AND meta 14 contains b

i try it with
count(object/node[@meta='27']/data you count data????

[(@meta='13' and contains(.,'a'))
with a meta attribute of 13 and containing an 'a' and (@meta='14' and contains(.,'b'))])

!and! with a meta attribute of 14 and containing an 'b'

your are looking for:
<data meta="13" meta="14">ab</data>

This would help:

<xsl:value-of select="
count(object/node[@meta=27 and ((data[@meta=13] and contains(.,'a')))
and (data[@meta=14] and contains(.,'b'))])" />
HIH

Jo
Dec 9 '05 #2
i want count the 'node' wich have the elements data meta=13 contains a
AND meta 14 contains b

Dec 9 '05 #3
In article <11**********************@g49g2000cwa.googlegroups .com>,
<ra*****@gmx.de> wrote:
i try it with
count(object/node[@meta='27']/data[(@meta='13' and contains(.,'a'))
and (@meta='14' and contains(.,'b'))])


That counts data elements having a meta attribute of 13 and a meta
attribute of 14. No element has two meta attributes, so you get no
matches.

You want to count nodes:

count(object/node[...])

where the node has a data child with @meta='13' and which contains 'a':

data[@meta='13' and contains(., 'a')]

and similarly

data[@meta='14' and contains(., 'b')]

so put those two conditions in the predicate.

-- Richard
Dec 9 '05 #4
great thanks

count(object/node[@meta='27' and ((data[@meta='13' and contains(.,'a')]
and (data[@meta='14' and contains(.,'b')]) ] )

Dec 9 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ramon M. Felciano | last post by:
Helo all -- I'm trying to gain a deeper understand for what type of semi-declarative programming can be done through XML and XPath/XSLT. I'm looking at graph processing problems as a testbed for...
2
by: Peter Gerstbach | last post by:
Hello, I need help on the new xsl:document element! I'm using XSLT version 1.1 to be able to use the <xsl:document> element, because I need more than 1 output files. I'm using Saxon 6.5.3 My...
3
by: Graham | last post by:
Hi, I am having trouble getting XSL to count the members of a group. What I am trying to do is group by <objectid.Contactid> and count the number of <activityid>'s for each <objectid.contactid>....
5
by: inquirydog | last post by:
Hi- Does anyone know a way to compare whether two nodes contain the same information in xslt (the name, attributes, and all content recursivly should be the same. I am interested in the case...
1
by: wardellcastles | last post by:
Is it possible to acccess a DOM object of the input XML inside of the XSLT script? I am planning to use <msxsl:script ..> with the C#.NET language. What I need to do is at the beginning of the...
4
by: Chris Kettenbach | last post by:
Hi Peter, I get error when processing the stylesheet. It errors here. <xsl:for-each select="registration)=1]"> specifically: Expression does not return a DOM node. registration)=1]<--
4
by: J | last post by:
I've spent most of the day on this, and I just can't seem to find a solution, please help me! :) I'm recieving XML that I can't modify that looks like: <?xml version="1.0"?> <Doc> <Page>...
2
by: Scott Sauyet | last post by:
I'm trying to select a subset of a WSDL document using XSLT and a simple text document describing the high-level elements to include. I have it working fine for selecting the services, bindings,...
2
jkmyoung
by: jkmyoung | last post by:
Here's a short list of useful xslt general tricks that aren't taught at w3schools. Attribute Value Template Official W3C explanation and example This is when you want to put dynamic values...
16
by: njsimha | last post by:
Hi, I have the following XML snippet: <root> <template1> <elem1>1000</elem1> <elem2> <subelem1>65</subelem1>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.