Re: [xsl] Creating a sequence from DSV strings

Subject: Re: [xsl] Creating a sequence from DSV strings
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Thu, 21 Oct 2010 19:27:50 +0200
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.

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




--


	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

Current Thread