firen
firen

Reputation: 1424

XSLT: How to get 'match' value in template to use it inside of the template

<xsl:template match="email|recall|shop|partners|ipad" mode="tab">
  <li id="{HERE_MATCHED_PATH}">
  </li>
</xsl:template>

Is there any possibility to get matched path and use it in place of {HERE_MATCHED_PATH}?

For example to get something like this:

<li id="email">
</li>

if matched pattern was 'email'.

Upvotes: 1

Views: 132

Answers (2)

Simmo
Simmo

Reputation: 3131

Try using:

<xsl:value-of select="local-name()"/>

Upvotes: 0

Emiliano Poggi
Emiliano Poggi

Reputation: 24816

Use name() or local-name(). In your case there is no difference as you are not dealing with namespace prefixes and both functions return the same value. For more information, see XPath functions reference.

Upvotes: 2

Related Questions