Re: [xsl] Does XSL have arrays?

Subject: Re: [xsl] Does XSL have arrays?
From: Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 4 Jan 2001 18:09:34 +0100 (MET)
> > How about using a chunk of XML as your 'array'?
> 
> That's why I said XSLT 1.1 will have 'arrays'.
> XSLT 1.0 doesn't, except by way of vendor-specific extension functions.
Well, XSLT 1.0 already has this facility:

<xsl:stylesheet version="1.0"
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
		xmlns:data="urn:data-section"
		exclude-result-prefixes="data">

<data:month name="Jan" days="0" />
<data:month name="Feb" days="31" />
<data:month name="Mar" days="59" />
<data:month name="Apr" days="90" />
<data:month name="May" days="120" />
<data:month name="Jun" days="151" />
<data:month name="Jul" days="181" />
<data:month name="Aug" days="212" />
<data:month name="Sep" days="243" />
<data:month name="Oct" days="273" />
<data:month name="Nov" days="304" />
<data:month name="Dec" days="334" />

<xsl:template match="/">
   Days since January, 1.:
   <xsl:value-of select="document('')/*/data:month[@name='Jan']/@days +
			 4" />
   <!-- +4, because today is the fourth -->
   or, if you have the number of the month
   <xsl:value-of select="document('')/*/data:month[1]/@days + 4" />
</xsl:template>

</xsl:stylesheet>

Cheers,
Oliver


/-------------------------------------------------------------------\
|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread