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

Re: Group consecutive elements based on child content

Subject: Re: Group consecutive elements based on child content
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Fri, 7 Sep 2007 09:08:47 -0700
Re:  Group consecutive elements based on child content
This is an example of not well defined problem.

In

>    <duration>
>        <nights>11</nights>
>        <price>111</price>
>        <price>222</price>
>        <price>333</price>
>        <price>444</price>
>        <price>-</price>
>    </duration>
>    <duration>
>        <nights>14</nights>
>        <price>999</price>
>        <price>222</price>
>        <price>333</price>
>        <price>444</price>
>        <price>-</price>
>    </duration>


will the two

>        <price>-</price>


elements match the corresponding previous

>     <price>555</price>

element, or will they match the vrresponding following

>        <price>456</price>

element?

In no way should both matchings be allowed, because then this
"quality" is no longer an equivalence relation -- it will follow that
555 = 456 and in fact that any two numbers are "equal"


The problem thus defined makes no sense.


Cheers,

Dimitre Novatchev



On 7/20/07, Kevin Bird <kevin.bird@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> Hi
>
> In the following structure I need to group consecutive <duration>
> elements based on the concatenation of the <price> elements. The added
> complication I have is that a price element can contain a number or
> hyphen. The hyphen acts like a wildcard in that it can match the price
> element in the preceding or following duration. A brief example of my
> problem is below.
>
> -------
> INPUT
> -------
> <holidays>
>    <duration>
>        <nights>7</nights>
>        <price>111</price>
>        <price>222</price>
>        <price>333</price>
>        <price>444</price>
>        <price>555</price>
>    </duration>
>    <duration>
>        <nights>10</nights>
>        <price>-</price>
>        <price>222</price>
>        <price>333</price>
>        <price>444</price>
>        <price>555</price>
>    </duration>
>    <duration>
>        <nights>11</nights>
>        <price>111</price>
>        <price>222</price>
>        <price>333</price>
>        <price>444</price>
>        <price>-</price>
>    </duration>
>    <duration>
>        <nights>14</nights>
>        <price>999</price>
>        <price>222</price>
>        <price>333</price>
>        <price>444</price>
>        <price>-</price>
>    </duration>
>    <duration>
>        <nights>21</nights>
>        <price>999</price>
>        <price>456</price>
>        <price>-</price>
>        <price>123</price>
>        <price>456</price>
>    </duration>
>    <duration>
>        <nights>28</nights>
>        <price>999</price>
>        <price>456</price>
>        <price>666</price>
>        <price>123</price>
>        <price>456</price>
>    </duration>
> </holidays>
>
> --------------
> DESIRED OUTPUT
> --------------
> <!-- <nights> text content is modified to reflect which durations have
> been grouped -->
> <holidays>
>    <duration>
>        <nights>7/10/11</nights>
>        <price>111</price>
>        <price>222</price>
>        <price>333</price>
>        <price>444</price>
>        <price>555</price>
>    </duration>
>    <duration>
>        <nights>14</nights>
>        <price>999</price>
>        <price>222</price>
>        <price>333</price>
>        <price>444</price>
>        <price>-</price>
>    </duration>
>    <duration>
>        <nights>21/28</nights>
>        <price>999</price>
>        <price>456</price>
>        <price>666</price>
>        <price>123</price>
>        <price>456</price>
>    </duration>
> </holidays
>
> Any help would be appreciated. I am using XSLT 2.0.
>
> Thanks.
>
> --
> Kevin
>
>


-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play

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.