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

Re: Select with multiple conditions?

Subject: Re: Select with multiple conditions?
From: "Wendell Piez wapiez@xxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 8 Dec 2021 16:24:57 -0000
Re:  Select with multiple conditions?
Hi again,

Another footnote is that even in XSLT 1.0 if we can contrive to bind the
values 'collection', 'recordgrp', 'series' and 'subseries' to XML somewhere
(for example loading them from an example document) we can then say
for-each select="*[@level=$levels]" where $levels is the set of XML nodes
with the given values.

This is more or less how we also do it in 2.0 or 3.0 with the benefit of
having $levels in a more convenient form such as a sequence of strings.

Cheers, Wendell


On Wed, Dec 8, 2021 at 11:19 AM Wendell Piez wapiez@xxxxxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> 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...
> 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...

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.