| Previous | Next
Attribute Value TemplatesIt's easy to include known attribute values in the output document as the literal content of a literal result element. For example, this template rule wraps each input <xsl:template match="person"> <span ><xsl:apply-templates/></span> </xsl:template> However, it's trickier if the value of the attribute is not known when the stylesheet is written, but instead must be read from the input document. The solution is to use an attribute value template. An attribute value template is an XPath expression enclosed in curly braces that's placed in the attribute value in the stylesheet. When the processor outputs that attribute, it replaces the attribute value template with its value. For example, suppose you wanted to write a name template that changed the input <name first="Richard" initial="P" last="Feynman"/> This template accomplishes that task:
The value of the |