Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi all
Could you help me? I need uniqu id for each <td>.
I have a variable:<xsl:variable name="iterator" select="0"/>
I want to increase a value of iterator in cycle. And as result id of <td> should be for example:
"td_id_0", "td_id_1", "td_id_2", etc.
As I've understood I should use concat(). But I don't understand how to increase value of iterator in cycle and how to put result of concatenation.
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<td id="">
</td>
</xsl:for-each>
Hey,
You can do something like this:
<td><xsl:attribute name="id">td_id_<xsl:value-of select="position()"/></xsl:attribute> </td>
Rich
Thank You, Rich.
Hi Alexey,
There's a convenient shortcut to that, using curly brackets (they're called an "Attribute Value Template"):
<td id="td_id_{position()}"> ... </td>
/Chriztian
Thank you, Chriztian!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Unique id for all elements
Hi all
Could you help me? I need uniqu id for each <td>.
I have a variable:
<xsl:variable name="iterator" select="0"/>
I want to increase a value of iterator in cycle. And as result id of <td> should be for example:
"td_id_0", "td_id_1", "td_id_2", etc.
As I've understood I should use concat(). But I don't understand how to increase value of iterator in cycle and how to put result of concatenation.
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<td id="">
</td>
</xsl:for-each>
Hey,
You can do something like this:
<td>
<xsl:attribute name="id">td_id_<xsl:value-of select="position()"/></xsl:attribute>
</td>
Rich
Thank You, Rich.
Hi Alexey,
There's a convenient shortcut to that, using curly brackets (they're called an "Attribute Value Template"):
/Chriztian
Thank you, Chriztian!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.