IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Profile: chrislada
About
User Name: chrislada
Forum Rank: Newbie
Real Name:
Location
Occupation:
Interests:
Gender: None Specified
Statistics
Joined: Wednesday, June 5, 2019
Last Visit: Wednesday, June 5, 2019 4:18:08 PM
Number of Posts: 1
[0.01% of all post / 0.00 posts per day]
Avatar
Last 10 Posts
Topic: Local XSLT Variable
Posted: Wednesday, June 5, 2019 4:18:08 PM
I am getting a 'Parameter or variable with this name already defined name="nested-refs"' error on the following code even though the variable is local to the individual templates. I can run this code with no problem in our Linus XSL processor. Is it the case that there is a param with the same name?

Code:
<xsl:template match="item.reference">
        <xsl:value-of select="$newline"/>
        <xsl:variable name="ref-kids" select="*[local-name() != 'name.block'                                                    and local-name() != 'item.reference']"/>
        <xsl:variable name="nested-refs" select="*[local-name() = 'item.reference']"/>
        <xsl:element name="ref">
            <xsl:element name="n">
                <xsl:call-template name="get_name_label_designator"/>
            </xsl:element>
            <xsl:apply-templates select="$ref-kids"/>
        </xsl:element>
        <xsl:call-template name="process-item-references">
            <xsl:with-param name="nested-refs" select="$nested-refs"/>
        </xsl:call-template>
    </xsl:template>
    <xsl:template name="process-item-references">
        <xsl:param name="nested-refs"/>
        <xsl:for-each select="$nested-refs">
            <xsl:variable name="ref-kids" select="*[local-name() != 'name.block' and local-name() != 'item.reference']"/>
            <xsl:variable name="nested-refs" select="*[local-name() = 'item.reference']"/>
            <xsl:element name="ref">
                <xsl:element name="n">
                    <xsl:call-template name="get_name_label_designator"/>
                </xsl:element>
                <xsl:apply-templates select="$ref-kids"/>
            </xsl:element>
            <xsl:call-template name="process-item-references">
                <xsl:with-param name="nested-refs" select="$nested-refs"/>
            </xsl:call-template>
        </xsl:for-each>
    </xsl:template>

Thanks
Chris

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.