Re: [xsl] Passing parameter into tag name

Subject: Re: [xsl] Passing parameter into tag name
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 12 Apr 2017 13:11:23 -0000
On 12.04.2017 15:06, Steve Wisniewski stevewiz76@xxxxxxxxx wrote:

<Cost ID='1'>
<Cost ID='2'>
<Cost ID='3'>
<Cost ID='4'>

I am trying to sum up the amounts in the following code, but am getting
a syntactical error about how I am trying to pass the parameter value
into the tag name:

<xsl:stylesheet version="2.0" xmlns="";
<xsl:output method="xml" indent="yes"/>

<xsl:template name="buildLevel">
<xsl:param name="levelNum"/>
<xsl:value-of select="sum(/Story/Level_{$levelNum}_Amt)"/>

You need to check the name with e.g. sum(/Story/*[local-name() = concat('Level_', $levelNum, '_Amt')])

Current Thread