count different child elements
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 30
- Joined: Wed Feb 14, 2018 3:27 pm
count different child elements
Post by mariomueller »
Hi all,
I got a XML like
How can I count the sum of all <B1> and <B2> nodes?
count(count(/A/B1) and count(/A/B2)) --> 1 which is wrong
count(/A/B1 and /A/B2) --> 1 which is wrong
correct would be 4
Thanks
Regards
Mario
I got a XML like
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<A>
<B1> </B1>
<B1> </B1>
<B2> </B2>
<B2> </B2>
<B3> </B3>
</A>
count(count(/A/B1) and count(/A/B2)) --> 1 which is wrong
count(/A/B1 and /A/B2) --> 1 which is wrong
correct would be 4
Thanks
Regards
Mario
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: count different child elements
Hi Mario,
Try this:
using "|" you can concat two (or more) node sequences.
Regards,
Radu
Try this:
Code: Select all
count(/A/B1 | /A/B2)
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 30
- Joined: Wed Feb 14, 2018 3:27 pm
-
- Posts: 30
- Joined: Wed Feb 14, 2018 3:27 pm
Re: count different child elements
Post by mariomueller »
Hi Radu,
many thanks. As you can see I found the same solution 1 minute later
Regards
Mario
many thanks. As you can see I found the same solution 1 minute later

Regards
Mario
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service