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(_at_)wendellpiez(_dot_)com <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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(_at_)wendellpiez(_dot_)com>
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']">
“or” 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(_at_)syr(_dot_)edu <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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 “better” than the others, and if so why? I’m guessing
that there are no differences in output, and that option 3 is better
because more concise. Am I right?
“or” statements in the select condition:
<xsl:for-each select="child::*[@level = 'collection'] | child::*[@level
= 'recordgrp'] | child::*[@level = 'series'] | child::*[@level =
'subseries']">
“or” statements inside the node description [ ]
<xsl:for-each select="child::*[@level = 'collection' | @level =
'recordgrp' | @level = 'series' | @level = 'subseries']">
“or” 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(_at_)syr(_dot_)edu | *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...
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--