Bert Verhees
Bert Verhees

Reputation: 1053

Getting values of an array XSLT

please help,

I have this values:

<xsl:variable name="PB" select="'/join/id/stop/regelingtype_007'"/>
<xsl:variable name="I" select="'/join/id/stop/regelingtype_008'"/> 
<xsl:variable name="VR" select="'/join/id/stop/regelingtype_009'"/>
<xsl:variable name="P" select="'/join/id/stop/regelingtype_010'"/> 

I have this array

<xsl:variable name="OP-implementatie" select="[
        $PB,
        $I,
        $VR,
        $P
        ]"/>

Now I want to analyze this xslt with another xslt I get a reference to the array like this

<xsl:variable name="vars" select="document('xxx')s/*/xsl:variable" />

I find the array like this

<xsl:variable name="array" select="$vars[@name = 'OP-implementatie']/@select"/>

Till here it works fine, I can it refers to the right array But now I want to use the values:

<xsl:element name="var"><xsl:value-of select="$array"/></xsl:element>

It just prints the array like this

<var>[         $PB,         $I,         $VR,         $P         ]</var>

And when I do this:

<xsl:element name="var"><xsl:value-of select="$array[1]"/></xsl:element>

It does exactly the same. I was hoping to retrieve the values of the array one by one, how can I do that?

Thanks very much for any help

Best regards Bert Verhees

Upvotes: 0

Views: 334

Answers (1)

Martin Honnen
Martin Honnen

Reputation: 167401

I would suggest to import the document with e.g. <xsl:import href="sheet1.xsl"/>, then you can select $OP-implementatie as the complete array and use e.g. $OP-implementatie?1 or $OP-implementatie(1) to get the first item in the array. It is not clear why you need to use the other XSLT as ordinary XML parsed with doc or document.

Upvotes: 2

Related Questions