xsl-list
[Top] [All Lists]

Re: [xsl] passing a sequence as a parameter

2008-02-26 04:39:18
At 12:31 26/02/2008, you wrote:
why don't you pass a string instead of a sequence?
"true,false,true"
use tokenise() to make it a sequence in the XSLT
and index-of to help you with selecting the <name> you want to output

in code

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    version="2.0">
    <xsl:output indent="yes"></xsl:output>
    <xsl:param name="my_params">true,false,true</xsl:param>
<xsl:param name="params_seq" select="tokenize($my_params, ',')"></xsl:param>
    <xsl:template match="/root">
        <root>
            <xsl:apply-templates/>
        </root>
    </xsl:template>
    <xsl:template match="user">
        <user>
<xsl:copy-of select="name[position() = index-of($params_seq, 'true')]"/>
        </user>
    </xsl:template>
</xsl:stylesheet>



--~------------------------------------------------------------------
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>
--~--