I found a way to pass a sequence of values between templates using the following code:
<xsl:call-template name="myTemplate">
<xsl:with-param name="myParam" select="@foo, @bar"/>
</xsl:call-template>
So, in this case the param myParam
in the template myTemplate
will be a sequence containing 2 values.
But, if you use the following code, it's not working:
<xsl:call-template name="myTemplate">
<xsl:with-param name="myParam">
<xsl:value-of select="@foo, @bar"/>
</xsl:with-param>
</xsl:call-template>
The result is a simple concatenation of @foo
and @bar
.
I also tried with <xsl:copy-of select="@foo, @bar"/>
but it's the same result.
So, can someone explains me how to pass a sequence of values in the content of <xsl:with-param />
and not directly via the select
attribute.
Thank you.
can someone explains me how to pass a list of values in the content of
<xsl:with-param />
and not directly via theselect
attribute.
Not sure why it's necessary to avoid the select
attribute. In fact, I believe it's preferable.
But to answer your question, you can use xsl:sequence
.
This is, of course, all in the context of XSLT 2.0.