[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Creating a sequence from DSV strings

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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.