Reputation: 811
What I want to do is like this,
XSLT
<xsl:variable name="concat('var',1)" select="'content of variable'"/>
But it causes an error
error: The '(' character, hexadecimal value 0x28, cannot be included in a name.
Is there any way to use concat in the name of variable?
Thank you a lot in advance.
Upvotes: 1
Views: 153
Reputation: 22647
No, this is hardly possible, because an XSLT processor resolves variable names at compile time. See for example this discussion:
http://www.velocityreviews.com/forums/t168700-generate-variable-name-from-node-values-in-xslt.html
I would recommend that you rearrange your XSLT stylesheets to eliminate the need for such a construct, i.e. variables with dynamic names. If you included more of your stylesheet and revealed your intent behind them, SO could help you rewrite the code.
By the way, if you plan to also create variable content dynamically, there are reasonable approaches to that.
Upvotes: 2