Re: [xsl] Navigationg thru XML Elements and manipulating them using XSLT

Subject: Re: [xsl] Navigationg thru XML Elements and manipulating them using XSLT
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Tue, 12 Nov 2002 07:04:37 +0100
Arrays are not known in XSLT. You only can create Javascript code from the XSLT.

Example:

<xsl:template match="Range">
  <xsl:apply-templates select="From"/>
</xsl:template>

<xsl:template match="From">
  <xsl:text/>Array[<xsl:value-of select="position()"/>]=<xsl:text/>
  <xsl:value-of select="."/>
</xsl:template>

So get first your Javascript working and create this Javascript afterwards dynamically.

Joerg

Chitra Lalita Madhwacharyula wrote:
Hello,

Is there any way to get a set of elements one by one and add it into an
array to be able to perform manipulations on them using java script ?

For e.g if we have

<?xml version="1.0"?>
<Testing>
<Range>
<From>500</From>
<To>300</To>
<From>300</From>
<To>400</To>
<From>600</From>
<To>1000</To>
</Range>
</Testing>

And I want to create an array which is the same size as the number of
the <From> elements and to which I want to add the contents of the form
element
Array[0]=500
Array[1]=300
Array[2]=600 and so on


Is it possible to do this using XSLT ?


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


Current Thread