xsl-list
[Top] [All Lists]

RE: Passing arrays into XSL

2006-02-25 12:03:05
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(_at_)saxonica(_dot_)com> 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(_at_)yahoo(_dot_)com] 
Sent: 24 February 2006 13:05
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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 



--~------------------------------------------------------------------
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>
--~--






--~------------------------------------------------------------------
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>
--~--




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

--~------------------------------------------------------------------
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>
--~--