Re: [xsl] passing a sequence as a parameter

Subject: Re: [xsl] passing a sequence as a parameter
From: Geert Bormans <geert@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 26 Feb 2008 12:38:40 +0100
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>


Current Thread