[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] passing a sequence as a parameter
Subject: [xsl] passing a sequence as a parameter From: "Robert Walpole" <robert.walpole@xxxxxxxxxxxx> Date: Tue, 26 Feb 2008 11:19:33 -0000 |
Hi, I am looking for a way of working with a sequence passed to a stylesheet as a parameter. For example, I have an xml file as follows... <root> <user> <name>Robert</name> <name>Adam</name> <name>Graham</name> </user> </root> ...which I want to pass to my XSLT along with a parameter containing a sequence of values, lets say ('true', 'false', 'true'). I then want to iterate through the name elements, only outputing something when the corresponding value in the sequence is 'true'. In this case I would want to return <root> <user> <name>Robert</name> <name>Graham</name> </user> </root> What I have so far is this... <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:param name="my_params"/> <xsl:template match="/root"> <root> <xsl:apply-templates/> </root> </xsl:template> <xsl:template match="user"> <user> <xsl:for-each select="name"> <xsl:if test="$my_params[...] = 'true'"> <name> <xsl:value-of select="."/> </name> </xsl:if> </xsl:for-each> </user> </xsl:template> </xsl:stylesheet> ...which needless to say doesn't work, but hopefully will make clearer what I am trying to do. Thanks in advance. Rob Walpole Devon Portal Developer Email robert.walpole@xxxxxxxxxxxx Web http://www.devonline.gov.uk Rob Walpole Devon Portal Developer Tel. 01392 382768 E-mail robert.walpole@xxxxxxxxxxxx
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XSLT 2.0 XML Schema defin, Michael Kay | Thread | Re: [xsl] passing a sequence as a p, Geert Bormans |
RE: [xsl] XSLT 2.0 XML Schema defin, Michael Kay | Date | Re: [xsl] passing a sequence as a p, Geert Bormans |
Month |