Re: [xsl] Select with multiple conditions?

Subject: Re: [xsl] Select with multiple conditions?
From: "Wendell Piez wapiez@xxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 8 Dec 2021 16:19:07 -0000
Ouch the send button hit itself sorry!

2nd expression rewritten:
<xsl:for-each select="child::*[@level = 'series' or @level = 'subseries']">

but we need XPath 2.0 to say
<xsl:for-each select="child::*[@level = ('series', 'subseries')]">

Cheers, Wendell



On Wed, Dec 8, 2021 at 11:16 AM Wendell Piez <wapiez@xxxxxxxxxxxxxxx> wrote:

> Michele,
>
> As Eliot notes, the pipe operator in XPath is shorthand for "union", not
> "or", although there are places (such as a match pattern) when a union
> ("give me As and Bs") can look and work like an "or" ("give me things that
> are A or B").
>
>
>
> So spelled out into long syntax (and keeping only two cases) your first
> for-each looks like
>
>
> <xsl:for-each select="child::*[attribute::level = 'series'] union
> child::*[attribute::level = 'subseries']">
>
>
>
>
> borb statements inside the attribute match
>
>
>
> <xsl:for-each select="child::*[@level = 'collection' | 'recordgrp' |
> 'series'  | 'subseries']">
>
> On Wed, Dec 8, 2021 at 9:54 AM Michele R Combs mrrothen@xxxxxxx <
> xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>> All three of these constructions appear to be valid (this is xsl 1.0,
>> sorry for being antiquated!).  Will there be differences in the output?
If
>> not, is one option bbetterb than the others, and if so why?  Ibm
guessing
>> that there are no differences in output, and that option 3 is better
>> because more concise.  Am I right?
>>
>>
>>
>>
>>
>> borb statements in the select condition:
>>
>>
>>
>> <xsl:for-each select="child::*[@level = 'collection']  | child::*[@level
>> = 'recordgrp']  | child::*[@level = 'series'] | child::*[@level =
>> 'subseries']">
>>
>>
>>
>> borb statements inside the node description [ ]
>>
>>
>>
>> <xsl:for-each select="child::*[@level = 'collection' | @level =
>> 'recordgrp' | @level = 'series' | @level = 'subseries']">
>>
>>
>>
>> borb statements inside the attribute match
>>
>>
>>
>> <xsl:for-each select="child::*[@level = 'collection' | 'recordgrp' |
>> 'series'  | 'subseries']">
>>
>>
>>
>>
>>
>> Michele
>>
>> *+++++++++*
>>
>> *Michele Combs* | Lead Archivist
>>
>> Special Collections Research Center
>> *Visit our blog!* library-blog.syr.edu/scrc/
>> Syracuse University Libraries
>> 222 Waverly Ave
>> Syracuse, New York 13244
>>
>> *t* 315.443-2081 | *e* mrrothen@xxxxxxx | *w* scrc.syr.edu
>>
>> *SYRACUSE UNIVERSITY*
>> syr.edu
>>
>>
>> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
>> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/174322> (by
>> email <>)
>>
>
>
> --
> ...Wendell Piez... ...wendell -at- nist -dot- gov...
> ...wendellpiez.com... ...pellucidliterature.org... ...pausepress.org...
> ...github.com/wendellpiez... ...gitlab.coko.foundation/wendell...
>


--
...Wendell Piez... ...wendell -at- nist -dot- gov...
...wendellpiez.com... ...pellucidliterature.org... ...pausepress.org...
...github.com/wendellpiez... ...gitlab.coko.foundation/wendell...

Current Thread