Jump to content

parameters & variables in element names


jetski

Recommended Posts

I am trying to use a parameter to as part of the element name in Xpath in order to select a certain element, but cannot get it to work. I want to select element named either Artist1,Artist2,Artist3,...ArtistNdepending on the value 'N' of parameter $ArtistCount, passed to the template.I have tried all combinations of quotation marks and parenthesis, this is a typical example.

<xsl:when test="boolean($thisSong/Artist'string($artistCount)')">

and

<xsl:when test="boolean($thisSong/Artist{string($artistCount)})">

However I have managed to use parameters as part of the element name I am creating. (using the name attribute in xsl:element)

<xsl:element name="RPI_{string($artistCount)}">

Is there a way to use a parameter's value as part of the element name in Xpath?

Link to comment
Share on other sites

  • 1 month later...

I was trying to have something like this with no success :) . However, I never tryed the parameter with string method, so... thank you :) .

Link to comment
Share on other sites

Try this

<xsl:when test="boolean($thisSong/[artist=concat('Artist',string($artistCount)))]" />

I've made a best guess based on some code I've used to create an id attribute when I load information into a textbox control.Let us know if it doesn't work.Dooberry

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...