Skip to content

xsl:value-of

Evaluates an XPath expression and writes its string value to the result tree as a text node.

<xsl:value-of select="@name"/>

If the expression returns a sequence of multiple items, they are concatenated with the separator between them (default: a single space in XSLT 2.0+ when select is present). For sequences of nodes, each item’s string value is used. To copy whole nodes (with their structure) use xsl:copy-of or xsl:sequence instead.

Attributes

Attribute Description
select XPath expression. Required unless a sequence constructor body is given.
separator String inserted between items when the result is a multi-item sequence.

Examples

Joining a sequence with a custom separator:

<xsl:value-of select="author/name" separator=", "/>

Body instead of select:

<xsl:value-of>
  <xsl:value-of select="firstname"/>
  <xsl:text> </xsl:text>
  <xsl:value-of select="lastname"/>
</xsl:value-of>