Thank you Martin. I used <xsl:iterate> because I was going to just return the
first match. But I see that I could have just used a [1] predicate.
From: Martin Honnen martin.honnen@xxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, March 24, 2023 12:22 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: Add items to a sequence
Am 3/24/2023 um 5:11 PM schrieb Martin Honnen martin.honnen@xxxxxx
<mailto:martin.honnen@xxxxxx> :
Am 3/24/2023 um 5:02 PM schrieb rick@xxxxxxxxxxxxxx
<mailto:rick@xxxxxxxxxxxxxx> :
I am not sure if I can ask this without giving more context, but I have a
function that loops through some regular expressions in a lookup file and
finds matches against a description element. When there is a match, I want to
return an element from my lookup file. I want to return a sequence because
there may be more than one regular expression match. In my function below, it
seems like it is returning a flattened sequence instead of a sequence of
distinct elements. If this isnbt enough context, I can try to mock up a more
complete example. Thank you.
Rick
<xsl:function name="rq:get-key-codes">
<xsl:param name="description" as="xs:string"/>
<xsl:param name="report-type" as="xs:string"/>
<xsl:iterate
select="$key-codes/key-codes/record[report[.=$report-type]]">
<xsl:param name="keyword-codes" as="empty-sequence()"/>
<xsl:on-completion>{$keyword-codes}</xsl:on-completion>
Here you don't want a text value template but
<xsl:on-completion select="$keyword-codes"/>
Of course I wonder whether you need the `xsl:iterate` and can't just use
<xsl:sequence
select="$key-codes/key-codes/record[report[.=$report-type]][matches($descript
ion, key-word,'i')]/key-code"/>
XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/612310> (by
email <> )
|