Hi Michael --
Pretty sure. Using equal would constrain it to exact matches, yes? Which is
not what I want. For example, I want to use "neg" to find "negatives"
"negative" "neg" "negs" and so on, since the exact phrasing may vary.
Michele
-----Original Message-----
From: Michael Kay mike(_at_)saxonica(_dot_)com
[mailto:xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com]
Sent: Wednesday, January 28, 2015 3:53 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Using contains with more than one string - XSLT2.0
Either use matches() as David Sewell suggests, or construct an expression along
the lines
contains(., 'abc') or contains(., 'xyz') or contains(., 'pqr')
But are you sure you actually want contains()? People often misuse it, thinking
it means "Node N contains value V". For that, you want an "equals" test.
Michael Kay
Saxonica
mike(_at_)saxonica(_dot_)com
+44 (0) 118 946 5893
On 28 Jan 2015, at 20:22, Michele R Combs mrrothen(_at_)syr(_dot_)edu
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
I've done some googling on this but nothing seems quite to match what I want
to do.
At the top of my style sheet I have this:
<xsl:variable name="target" select="'Photo'"/>
Then later I do this to find all titles with that string in them:
<xsl:for-each
select="//dsc//unittitle[contains(normalize-space(.),$target)]">
So far so good, works great. The problem comes when I want to tell the
contains function to match on any one of several strings, e.g. Photo or Neg
or Film. So far I have tried the following but none of them work:
<xsl:variable name="target" select="'Photo|Neg'"/>
<xsl:variable name="target" select="'Photo'|'Neg'"/>
<xsl:variable name="target" select="'Photo' or 'Neg'"/>
<xsl:variable name="target" select="'Photo Neg'"/>
If I must, I can stick the or'ed terms directly in the contains function
rather than using a variable, but when I tried a few variations on that, they
didn't work either.
Thanks
Michele
+++++++++++++++
Michele Combs
Lead Archivist
Special Collections Research Center
Syracuse University Libraries
315-443-2081
mrrothen(_at_)syr(_dot_)edu
scrc.syr.edu
--~----------------------------------------------------------------
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
--~--