AW: [xsl] ordered selection of child elements

Subject: AW: [xsl] ordered selection of child elements
From: "Dr. Patrik Stellmann patrik.stellmann@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 8 Mar 2018 07:40:53 -0000
Thanks to both of you for the explanations. And indeed, using "!" works fine
for me.

Regards,
Patrik

>
------------------------------------------------------------------
Systemarchitektur & IT-Projekte
Tel: +49 40 33449-1142
Fax: +49 40 33449-1400
E-Mail: mailto:Patrik.Stellmann@xxxxxxxxx

-----UrsprC<ngliche Nachricht-----
> Von: Imsieke, Gerrit, le-tex gerrit.imsieke@xxxxxxxxx [mailto:xsl-list-
> service@xxxxxxxxxxxxxxxxxxxxxx]
> Gesendet: Donnerstag, 8. MC$rz 2018 08:07
> An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Betreff: Re: [xsl] ordered selection of child elements
>
> As to Patrikbs question bwhyb?
>
> 1. bWhyb in the sense of bwhere is this behavior specified?b
>
> https://www.w3.org/TR/xpath-31/#id-path-operator
>
> If every evaluation of E2 returns a (possibly empty) sequence of nodes,
these
> sequences are combined, and duplicate nodes are eliminated based on node
> identity. The resulting node sequence is returned in document order.
>
> 2. Why is it specified to behave like this?
>
> Probably because of the deduplication requirement. If the right-hand side
> expression E2 initially returns the sequences (c, b, a) and (a, b)
> *and* you want to deduplicate the combined sequence, there will be an
ambiguity
> whether to return (c, a, b) or (c, b, a). With the additional document order
> requirement it will reduce to (a, b, c) if we assume that this reflects the
document
> order.
>
> 3. Which purpose does the deduplication requirement serve?
>
> I think this comes in very handy at times.
>
> As Martin said, you can use the ! operator or a 'for $var in E1 return
($var/a,
> $var/b)' expression if you want the post-/ evaluation results returned in
this
> particular order and if you donbt want to repeat E1.
>
> Gerrit
>
>
> Gerrit
>
>
> On 08/03/2018 07:54, Martin Honnen martin.honnen@xxxxxx wrote:
> > Am 08.03.2018 um 07:36 schrieb Dr. Patrik Stellmann
> > patrik.stellmann@xxxxxxxxx:
> >>
> >> Hi,
> >>
> >> a question more motivated by curiosity than by a real problem:
> >>
> >> With
> >>
> >> <xsl:sequence select=ba, bb/>
> >>
> >> I will get first element a and second element b b no matter of the
> >> order within the input document.
> >>
> >> But with
> >>
> >> <xsl:sequence select=broot/(a, b)b/>
> >>
> >> I will get the elements a and b in document order. So this behaves
> >> identical to
> >>
> >>             <xsl:sequence select=broot/(a | b)b/>
> >>
> >> Why?
> >>
> >> Of course I could write
> >>
> >> <xsl:sequence select=broot/a, root/bb/>
> >>
> >> To ensure a specific order. But sometimes the expression of brootb is
> >> much more complex so Ibd like to avoid writing it twice or putting it
> >> in a variableb&
> >>
> > You can move to XPath/XSLT 3 and use the "!" operator
> >
> >    root!(a, b)
> >
> >
> >
> > XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> > EasyUnsubscribe <-list/225679>
> > (by email <>)
>
> --
> Gerrit Imsieke
> GeschC$ftsfC<hrer / Managing Director
> le-tex publishing services GmbH
> Weissenfelser Str. 84, 04229 Leipzig, Germany Phone +49 341 355356 110, Fax
> +49 341 355356 510 gerrit.imsieke@xxxxxxxxx, http://www.le-tex.de
>
> Registergericht / Commercial Register: Amtsgericht Leipzig Registernummer /
> Registration Number: HRB 24930
>
> GeschC$ftsfC<hrer / Managing Directors:
> Gerrit Imsieke, Svea Jelonek, Thomas Schmidt
>

GDV Dienstleistungs-GmbH
GlockengieCerwall 1
D-20095 Hamburg
www.gdv-dl.de

Niederlassungen:

WilhelmstraCe 43 / 43 G
10117 Berlin

FrankenstraCe 18a
20097 Hamburg

Sitz und Registergericht: Hamburg
HRB 145291
USt.-IdNr : DE 205183123

GeschC$ftsfC<hrer:
Dr. Jens Bartenwerfer
Michael Bathke
Fred di Giuseppe Chiachiarella
Thomas Fischer

Aufsichtsratsvorsitzender: Werner Schmidt

------------------------------------------------------------------
Diese E-Mail und alle AnhC$nge enthalten vertrauliche und/oder rechtlich
geschC<tzte Informationen. Wenn Sie nicht der richtige Adressat sind oder
diese E-Mail irrtC<mlich erhalten haben, in-formieren Sie bitte sofort den
Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die
unbefugte Weitergabe der E-Mail ist nicht gestattet.

This e-mail and any attached files may contain confidential and/or privileged
information. If you are not the intended recipient (or have received this
e-mail in error) please notify the sender im-mediately and destroy this
e-mail. Any unauthorised copying, disclosure or distribution of the material
in this e-mail is strictly forbidden.

Current Thread