[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] How to count elments which have specific sub element

Subject: Re: [xsl] How to count elments which have specific sub element
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 10 May 2012 11:57:33 -0400

At 2012-05-10 15:52 +0100, henry human wrote:
How can I count ONLY the  TaxTotal elements which HAS Amount
I tried Count(TaxTotal/cbc:RoundingAmount) but it is wrong as expctted!

As Dmitry says, it is difficult to guess what you want because your question is unclear.

But I recognize your use of elements and namespace prefixes as likely being OASIS UBL.

Looking at the TaxTotal aggregate (note the page is very long and takes a while to load):


... I see that <cbc:TaxAmount> is a mandatory child of <cac:TaxTotal>. Therefore you know the count of those children is the same as the count of the parents.

But you cite <cbc:RoundingAmount> in your question. Are you perhaps looking for the count of those <cac:TaxTotal> elements that have the optional <cbc:RoundingAmount> child? That would be:


... which actually would be the same as the count of the rounding amounts:


I hope this helps ... but it is only a guess.

. . . . . . . . . . Ken

-- Public XSLT, XSL-FO, UBL and code list classes in Europe -- Oct 2012 Contact us for world-wide XML consulting and instructor-led training Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal

Current Thread