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

RE: Increment value by group

Subject: RE: Increment value by group
From: "watchstone@xxxxxxxxxxx" <watchstone@xxxxxxxxxxx>
Date: Wed, 11 Jan 2006 17:04:17 GMT
increment 1 1
Sorry, I cut down my example so as to not overwhelm the reader --

Desired output:

<document>
<job>
<status>1/1-3</status>
</job>
<job>
<status>1/4-5</status>
</job>
<job>
<status>2/1-4</status>
</job>
<job>
<status>2/5</status>
</job>

-------- Original Message --------
Subject: RE:  Increment value by group
Date: Wed, 11 Jan 2006 16:44:20 -0000
From: Michael Kay <mike@xxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>

You'll have to explain more clearly. I can't see any relationship between
the four jobs in your input and the five jobs in your output.

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: watchstone@xxxxxxxxxxx [mailto:watchstone@xxxxxxxxxxx]
> Sent: 11 January 2006 16:18
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Increment value by group
>
> Hello:  I want to process nodes based on grouping by
> <quantity>. The  <increment> element is used as a running
> "total" based on grouping.  So basically, when <quantity> is
> "1", I want to process all of them as a group and use the
> <increment> value to produce an output like this:
>
> 1/1-3 (i.e. <increment> value is "3")
> 1/4-5 (i.e. <increment> value if "2" but starts with
> preceding <increment value)
>
> When <quantity> changes, I want the <increment> value to also
> start over with "1".
>
> Can I use <xsl:for-each-group> or some such element to
> accomplish this.
>
> <?xml version="1.0"?>
> <document>
> <job>
> <quantity>1</quantity>
> <increment>3</increment>
> </job>
> <job>
> <quantity>1</quantity>
> <increment>2</increment>
> </job>
> <job>
> <quantity>2</quantity>
> <increment>4</increment>
> </job>
> <job>
> <quantity>2</quantity>
> <increment>1</increment>
> </job>
> </document>
>
> Desired output:
>
> <document>
> <job>
> <status>1/1-3</status>
> </job>
> <job>
> <status>1/4-5</status>
> </job>
> <job>
> <status>1/6</status>
> </job>
> <job>
> <status>2/1-4</status>
> </job>
> <job>
> <status>2/5</status>
> </job>
> </document>

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.