This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: How to select a numbered group of elements
- From: "Carmelo Montanez" <carmelo at nist dot gov>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Tue, 19 Feb 2002 11:57:25 -0500
- Subject: Re: [xsl] How to select a numbered group of elements
- References: <80256B65.005A886C.00@lonhm0004.arthurandersen.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
I think the mod operator and "position()" function should work,
something like
<xsl:if test = "(position() mod 3) = 0">
Good Luck,
Carmelo
----- Original Message -----
From: <philip.borg@uk.andersen.com>
To: <xsl-list@lists.mulberrytech.com>
Sent: Tuesday, February 19, 2002 10:50 AM
Subject: [xsl] How to select a numbered group of elements
>
>
> I have an xml file like (there can be any number of <tx> elements)
>
> <payment>
>
<tx><paymentId>123456</paymentId><payType>EURO</payType><amt>10.00</amt></tx
>
>
<tx><paymentId>123457</paymentId><payType>EURO</payType><amt>20.00</amt></tx
>
>
<tx><paymentId>123458</paymentId><payType>EURO</payType><amt>30.00</amt></tx
>
>
<tx><paymentId>123459</paymentId><payType>EURO</payType><amt>40.00</amt></tx
>
>
<tx><paymentId>123460</paymentId><payType>EURO</payType><amt>50.00</amt></tx
>
> </payment>
>
> which I need to group in sets of 3 so that I can output a checksum line
every
> three lines of the <amt> tags. I also need to do this for the last line as
well
>
> eg
> Header Text
> 123456 EURO 10.00
> 123457 EURO 20.00
> 123458 EURO 30.00
> Checksum 60.00
> 123459 EURO 40.00
> 123460 EURO 50.00
> Checksum 90.00
> Footer text
>
> Is this possible with XSLT
>
> *******************Internet Email Confidentiality
Footer*******************
> A list of the names of the partners in the UK firm of Arthur Andersen is
open to
> inspection at 180 Strand, London, WC2R 1BL (principal place of business).
>
> Privileged/Confidential Information may be contained in this message. If
you
> are not the addressee indicated in this message (or responsible for
delivery of
> the message to such person), you may not copy or deliver this message to
anyone.
> In such case, you should destroy this message and kindly notify the sender
by
> reply email. Please advise immediately if you or your employer does not
consent
> to Internet email for messages of this kind. Opinions, conclusions and
other
> information in this message that do not relate to the official business of
my
> firm shall be understood as neither given nor endorsed by it.
>
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list