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

Re: Grouping adjacent elements by value - within a ran

Subject: Re: Grouping adjacent elements by value - within a range
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Fri, 13 Aug 2010 12:20:54 +0100
Re:  Grouping adjacent elements by value - within a ran
You might get someone to do this for you - but to me its less of a
question and more of a high level requirement for some quotable
work...

cheers
andrew

On 13 August 2010 10:35, Kevin Bird <kevin.bird@xxxxxxxxxxxxxxxxxxxxxxx>
wrote:
> Hello
>
> I typeset price tables for Tour Operators brochures. Due to design changes,
the space left to display price information has been reduced. I need to group
adjacent <price> elements that are within a certain range (the range would be
passed as a parameter). Once the price groupings are worked out, I then need
to modify the corresponding <period> elements.
>
> The example below shows adjacent price elements grouped that are within a
range of #20 (with the lowest price returned). Using the same groupings, the
<period> elements are modified by taking the first <startdate> and last
<enddate>.
>
> I can use XSLT 2.0.
>
>
> =========================
> SOURCE XML
> =========================
>
> <?xml version="1.0" encoding="UTF-8"?>
> <grid>
>        <row id="periods">
>                <period>
>                        <startdate>01-Sep-2010</startdate>
>                        <enddate>19-Sep-2010</enddate>
>                </period>
>                <period>
>                        <startdate>20-Sep-2010</startdate>
>                        <enddate>25-Sep-2010</enddate>
>                </period>
>                <period>
>                        <startdate>26-Sep-2010</startdate>
>                        <enddate>30-Sep-2010</enddate>
>                </period>
>                <period>
>                        <startdate>01-Oct-2010</startdate>
>                        <enddate>11-Oct-2010</enddate>
>                </period>
>                <period>
>                        <startdate>12-Oct-2010</startdate>
>                        <enddate>31-Oct-2010</enddate>
>                </period>
>        </row>
>        <row id="prices">
>                <price>1209</price>
>                <price>1109</price>
>                <price>1129</price>
>                <price>1359</price>
>                <price>1369</price>
>        </row>
> </grid>
>
>
> =========================
> RESULT XML
> =========================
>
> <?xml version="1.0" encoding="UTF-8"?>
> <grid>
>        <row id="periods">
>                <period>
>                        <startdate>01-Sep-2010</startdate>
>                        <enddate>19-Sep-2010</enddate>
>                </period>
>                <period>
>                        <startdate>20-Sep-2010</startdate>
>                        <enddate>30-Sep-2010</enddate>
>                </period>
>                <period>
>                        <startdate>01-Oct-2010</startdate>
>                        <enddate>31-Oct-2010</enddate>
>                </period>
>        </row>
>        <row id="prices">
>                <price>1209</price>
>                <price>1109</price>
>                <price>1359</price>
>        </row>
> </grid>
>
>
> Any help greatly appreciated.
>
> --
> Kevin
>
>



--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

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.