On 21 October 2010 18:27, Martin Honnen <Martin(_dot_)Honnen(_at_)gmx(_dot_)de>
wrote:
James Abley wrote:
I am trying to pass in a DSV string parameter; e.g. "1234,356,6576" to
my stylesheet processing. The string may contain zero, one or many
members.
I'm trying to create a sequence using this parameter.
Isn't
tokenize("1234,356,6576", ",")
all you need.
Yes, that occurred to me as I was driving home yesterday. Just needed
a bit of space from the problem to see the simpler option.
I then want to check to see whether an attribute in my source document
is contained within that sequence and do different processing based on
the result.
I'm struggling converting the string into a sequence.
I have these globals in my stylesheet:
<!-- CSV list of article IDs which can be linked to -->
<xsl:param name="article_ids" as="xs:string*" select="'392795'" />
<xsl:variable name="article_id_list">
<xsl:analyze-string select="$article_ids" regex='([0-9]+)'>
<xsl:matching-substring>
<xsl:value-of select="regex-group(1)"/>
</xsl:matching-substring>
</xsl:analyze-string>
</xsl:variable>
<xsl:variable name="article_id_list" as="xs:string*"
select="tokenize($article_ids, ',')"/>
I have the following function intended to operate on the sequence.
<!--
XPath function which returns true if the sequence contains the
candidate item, otherwise false.
You don't need a function simply check
$article_id_list = $candidate-string
Thanks, I wasn't aware of that. Less code is always better!
Cheers,
James
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--