0

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

1
  • What is the result you are trying to get? And which verion of XSLT can you use? Commented Sep 18, 2020 at 15:21

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

5 Comments

It is a promising solution, thanks. The disadvantage is the import is a problem because of conflicting root element. Or is it possible to import nodes from another document? Why I need to do that is a long story, it has to with analyzing xslt documents.
@BertVerhees, any imported should normally have lower priority than your importing code so conflicts should not arise.
I will try tomorrow and will let you know. Thanks again
Sorry, it does not work, internal references of the stylesheet imported start to object, because in the importing situation their XPath has changed.
For others who are searching the answer for a similar problem, I solved like this: <xsl:variable name="AMvB_MR_BRG" select="/regelingtype_001 /regelingtype_002"/> The strings without quotes per item and forwarding slash, and that worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.