Reputation: 71
Please Help me with this code, It gives an error of "too many items" in line 3:
<xsl:when test=".[@name='Measurement Pallete']">
<xsl:variable name="controlID" select=".[@name='Measurement Pallete']/Control/@id"/>
<xsl:variable name="control_ID" select="translate($controlID, ' ', '')"/>
<xsl:variable name="funcName" select="concat('ClassicTab', $control_ID)"/>
</xsl:when>
The input Xml is of the format
<window name="">
<Control id="" type=""/>
<Control id="" type=""/>
</window>
I want that variable funcname should concatenate "HomeTab" before the name of each Control where window name is "Measurement Pallete"
Complete Stylesheet
<xsl:template match="/">
<xsl:for-each select="//window">
<xsl:result-document href="{concat('Windows/', @id, '.cs')}">
<xsl:choose>
<xsl:when test="current()[@name='Measurement Pallete']">
<xsl:variable name="controlID" select="current()[@name='Measurement Pallete']/Control/@id"/>
<xsl:variable name="control_ID" select="translate($controlID, ' ', '')"/>
<xsl:variable name="funcName" select="concat('ClassicTab', $control_ID)"/>
<xsl:call-template name="csfile1">
<xsl:with-param name="func_name" select="$funcName"/>
</xsl:call-template>
<xsl:call-template name="automationIDs1">
<xsl:with-param name="func_name" select="$funcName"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="csfile"/>
<xsl:call-template name="automationIDs"/>
</xsl:otherwise>
</xsl:choose>
</xsl:result-document>
</xsl:for-each>
</xsl:template>
Upvotes: 0
Views: 197
Reputation: 7173
It is because $controlID
spews out 2 values (I am assuming this is xsl 2.0 because of xsl:result-document
), Control[1]/@id
and Control[2]/@id
, the error comes from
<xsl:variable name="control_ID" select="translate($controlID, ' ', '')"/>
because you can't take more than one sequence as a first argument of translate
.
Upvotes: 1