This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Desperately need help with array
- To: <xsl-list at mulberrytech dot com>
- Subject: RE: Desperately need help with array
- From: "Chris Bayes" <Chris at Bayes dot co dot uk>
- Date: Fri, 28 Jul 2000 19:08:32 +0100
- Reply-To: xsl-list at mulberrytech dot com
Thuy,
<xsl:template match="/">
<script language="JavaScript">
title_array = new Array(
<xsl:for-each select="title">
"<xsl:value-of select=".">"
<xsl:if test="not(position()=last())">,</xsl:if>
</xsl:for-each>
);
author_array = new Array(
<xsl:for-each select="author">
"<xsl:value-of select=".">"
<xsl:if test="not(position()=last())">,</xsl:if>
</xsl:for-each>
"");
</script>
</xsl:template>
will probably do it altough I haven't tested it.
>-----Original Message-----
>From: owner-xsl-list@mulberrytech.com
>[mailto:owner-xsl-list@mulberrytech.com]On Behalf Of Thuy Do
>Sent: 28 July 2000 16:42
>To: xsl-list@mulberrytech.com
>Subject: Desperately need help with array
>
>
>Hi all,
>
>I got this xml:
>......
><title>the key to your success</title>
><author>Jill Bond</author>
><title>all about frogs</title>
><author>Frogs</author>
>.
>.
>.
>
>what I like to do is to have an array for <title> and an array for <author>
>in my Javascript
>like this:
>
><script language="javascript">
> title_array : new Array("the key to your success", "all about frogs")
> author_array : new Array("Jill Bond", "Frogs")
> .
> //I am using these arrays on some functions
> .
></script>
>
>could anyone please help me with this? Please please please...
>
>much appreciated,
>
>Thuy
>
>
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list