Re: [xsl] Filtering, xslt 2.0

Subject: Re: [xsl] Filtering, xslt 2.0
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 31 Oct 2022 16:22:23 -0000
Am 10/31/2022 um 5:16 PM schrieb Dave Pawson dave.pawson@xxxxxxxxx:
Input xml contains
<data>
...
    <membership>....</membership>
</data>
where membership can be one of a b c d

cmd line param
membership=a
could be membership=a,b,c

How to 'choose' only those matching the param values?
<xsl:template match="data">
<xsl:if test="$membership =./membership">
     <xsl:message>
    <xsl:value-of select='membership_type'/>
  </xsl:message>
     <xsl:apply-templates/>
   </xsl:if>
..


How to pass a list, and then check for membership of that list, one or more times?

I see two options, pass in a single string like you do and tokenize e.g.


B tokenize($membership, ',') = membership

or use an XPath expression for the parameter with e.g. (Saxon 9/10/11, I
think)

B ?membership='a','b','c'

(might need other/additional quotes, depending on the command shell), then

B $membership = membership

should do.

Current Thread