[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to count elments which have specific sub elem

Subject: Re: How to count elments which have specific sub element
From: henry human <henry_human@xxxxxxxx>
Date: Thu, 10 May 2012 17:24:53 +0100 (BST)
Re:  How to count elments  which have specific sub elem
Thank you guyes. But I recognized that the count of elements does not help!
Because I still do not know which ot the counted Taxtotals has the specific
element I am looking for!
(in the sample the specific element was Amount)

It
will helpe me if you read my secound posting titeld 'Get the first Array
elment'

Thank you

----- Urspr|ngliche Message -----
Von: G. Ken Holman
<gkholman@xxxxxxxxxxxxxxxxxxxx>
An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx; xslforum
xslforum <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
CC: 
Gesendet: 17:57 Donnerstag,
10.Mai 2012
Betreff: Re:  How to count elments which have specific sub
element

At 2012-05-10 15:52 +0100, henry human wrote:
> Hi
> <elements>
>
....
>  <TaxTotal>
>  <otherAmount>22.00</otherAmount>
>  </TaxTotal>
> 
.......
>  <TaxTotal>
>  <otherAmount>90.00</otherAmount>
>  </TaxTotal>
> 
<TaxTotal>
>      .....
>  <Amount>44.00</Amount>
>  </TaxSubtotal>
> 
</TaxTotal>
>  <TaxTotal>
>  .....
>  <Amount>10.00</Amount>
>  </TaxSubtotal>
>  </TaxTotal>
>  ......
> </elements>
> ---------------------
> 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):
http://docs.oasis-open.org/ubl/prd2-UBL-2.1/mod/summary/reports/UBL-AllDocume
nts-2.1.html#t-CommonLibrary-1820

... 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:

  count(cac:TaxTotal[cbc:RoundingAmount])

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

 
count(cac:TaxTotal/cbc:RoundingAmount)

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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.