hi deepak!
i missed the beginning of this thread (new to this list), but i'll try
an answer:
Deepak wrote:
I am bit new to XSL processing. If we can't pass the
arrays into XSL, then i hope that we can pass array
string as a variable.
Say i have an XML file
<colors>
<color>color[1]<color>
<color>color[2]<color>
<color>color[3]<color>
</colors>
are those square brackets just meant as an example, or are you thinking
about the array syntax of other languages?
xsl does not have the notion of indexed arrays. the square brackets you
will see in xpath statements are *predicates* that will select from a
node-set.
what you could do is this:
<colors>
<color>blue</color>
<color>red</color>
<color>an obnoxious shade of pink</color>
</color>
<xsl:template match="colors/color[2]">
<xsl:value-of select="."/>
</xsl:template>
this will produce "red" as an output, since it's the second <color> element.
if you want to check whether "blue" is in the list of colors, you can do
<xsl:template match="colors/color[text() = 'blue']">
<xsl:text>Your color list contains "blue".</xsl:text>
</xsl:template>
generally, square brackets can mean two things:
(1) from a set of nodes, select those for which the expression in the
square brackets is true;
(2) if the expression in square brackets produces not a boolean but a
number n, return the nth node from the set.
hope that helps,
jörn
--
jörn 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
--~------------------------------------------------------------------
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>
--~--