RE: [xsl] Passing arrays into XSL

Subject: RE: [xsl] Passing arrays into XSL
From: Deepak <deepak_vn@xxxxxxxxx>
Date: Sat, 25 Feb 2006 11:03:05 -0800 (PST)
Hi,


Thanks for the mail.

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>

And my XSL may looks like

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:variable name="arrayString">
   color[1],color[2]
</xsl:variable>

<xsl:template match="colors">

<xsl:if test="contains(color,$arrayString)">
 <xsl:text> do something</xsl:text>
</xsl:if>
</xsl:template>

</xsl:stylesheet>

The above XSL will fail to process to match with
multiple values in the array string.

So in this case how we can fix the searching problem ?


Thanks and regards,
Deepak




--- Michael Kay <mike@xxxxxxxxxxxx> wrote:

> The kinds of object you can pass as the value of an
> xsl:param depend on your
> processor. The XSLT 1.0 type system includes
> node-sets, which you may or may
> not be able to supply as an array of nodes,
> depending on your processor.
> It's unlikely that an XSLT 1.0 processor would
> support any other kind of
> array. XSLT 2.0 supports sequences of nodes or
> atomic values, so it's much
> more likely that you will be able to pass, say, an
> array of strings or
> integers.
> 
> But the best way of passing a complex object as
> input to the transformation
> is to represent the complex object as XML, because
> that's what XSLT is
> designed to handle.
> 
> Michael Kay
> http://www.saxonica.com/  
> 
> > -----Original Message-----
> > From: Deepak [mailto:deepak_vn@xxxxxxxxx] 
> > Sent: 24 February 2006 13:05
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: [xsl] Passing arrays into XSL
> > 
> > Hi,
> > 
> > I was wondering is that possible to pass an array
> > object to XSL and retreve the values from array.
> > 
> > Do you have any suitable example examplains above
> > details ?
> > 
> > Thanks and Regards.,
> > deepak
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> > http://mail.yahoo.com 
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Current Thread