[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: James Abley <james.abley@xxxxxxxxx>
Date: Fri, 22 Oct 2010 09:42:22 +0100
Re:  Creating a sequence from DSV strings
On 21 October 2010 18:27, Martin Honnen <Martin.Honnen@xxxxxx> 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
> B 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:
>> B  B  B  B <!-- CSV list of article IDs which can be linked to -->
>> B  B  B  B <xsl:param name="article_ids" as="xs:string*" select="'392795'"
>> B  B  B  B <xsl:variable name="article_id_list">
>> B  B  B  B  B  B <xsl:analyze-string select="$article_ids"
>> B  B  B  B  B  B <xsl:matching-substring>
>> B  B  B  B  B  B  B  B <xsl:value-of select="regex-group(1)"/>
>> B  B  B  B  B  B </xsl:matching-substring>
>> B  B  B  B  B  B </xsl:analyze-string>
>> B  B  B  B </xsl:variable>
> B  B  B  B <xsl:variable name="article_id_list" as="xs:string*"
> select="tokenize($article_ids, ',')"/>
>> I have the following function intended to operate on the sequence.
>> B  B <!--
>> B  B  B  B XPath function which returns true if the sequence contains the
>> candidate item, otherwise false.
> You don't need a function simply check
> B  $article_id_list = $candidate-string

Thanks, I wasn't aware of that. Less code is always better!



Current Thread


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.
First Name
Last Name
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.