[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Passing arrays into XSL


Subject: Re: [xsl] Passing arrays into XSL
From: Joern Nettingsmeier <nettings@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 26 Feb 2006 17:48:54 +0100

Deepak wrote:
Hi Jern,

Thanks for your help.

But my need is bit different, we have to match with
the strings from the variable or the parameter from a
servlet response.


So i need to match those strings available in the
'param' with actual xml file. The xml file nodes may
be more than blue,red colors. So the XSL display
should be depends on the values available in the
param. The parameter string may be with a delimiter
','(red, blue) or '' (red blue). <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">


<xsl:param name="arrayString">

you should re-name your variable. it's not an array.


for space-separated values, the term "list" is common in XML.
for comma-separated values, i'd suggest CSVsomething.

   blue,red
</xsl:param>

<xsl:template match="colors">

<xsl:if test="contains(color,$arrayString)">

make that "contains($colorList, color/text())", and you should be fine.


 <xsl:text> do something</xsl:text>
</xsl:if>
</xsl:template>

</xsl:stylesheet>

regards,


jvrn


-- jvrn nettingsmeier

home://germany/45128 essen/lortzingstr. 11/
http://spunk.dnsalias.org
phone://+49/201/491621

if you are a free (as in "free speech") software developer
and you happen to be travelling near my home, drop me a line
and come round for a free (as in "free beer") beer. :-D


Current Thread
Keywords