If an attribute contains one or more curly brackets their contents is evaluated as an XPath expression. Several curly brackets optionally separated by some text can be used in attribute value.
|
XSLT
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/> <xsl:template match="/*"> <xxx x="{@r + @s}" y="{@r}-{@s}-{@r}.xxx" z="@p={@p}"/> </xsl:template> </xsl:stylesheet> |
|
|
XML
<aaa r="3" s="11" p="qqq"/> |
Output
<xxx x="14" y="3-11-3.xxx" z="@p=qqq"/> |
| Previous chapter: | Conditional Expressions |
| Next chapter: | Groups |
| Previous page: | Literal result elements |
| Next page: | Escaping curly brackets |