Piotr Dajlido
Piotr Dajlido

Reputation: 2030

XSLT2.0 | Saxon HE | passing separator as param

Having function like this below:

<xsl:function name="fn:get-hierachy">

    <xsl:param name="hierarchy"   required="yes" as="node()"/>
    <xsl:param name="separator0"  required="no"  as="xs:string"/>

    <xsl:value-of select="$hierarchy/*" separator="$separator0"/>

</xsl:function>

I'm getting 'separator0' as a delimiter for output eg.

<xsl:value-of select="fn:get-hierarchy($place, ' > ')"/> result in:

Earth$separator0Africa$separator0Egypt

I'm passing my custom delimiter as a second function argument = ' > ' but it's being ignored and variable name is used instead.

Desired output: Earth > Africa > Egypt

Is it possible to pass separator argument value as a parameter?

Upvotes: 2

Views: 87

Answers (1)

Martin Honnen
Martin Honnen

Reputation: 167716

For the separator attribute, you need to use an attribute value template <xsl:value-of select="$hierarchy/*" separator="{$separator0}"/>.

Upvotes: 2

Related Questions