<xsl:value-of> Element

<xsl:value-of> Element

Inserts the value of the selected node as text.

  select = Expression
  disable-output-escaping = "yes" | "no" 

Required. The Expressions (XML) to be evaluated against the current context. The results are converted to a string, as by a call to the string() function. A node-set is converted to a string by inserting the string value of the first node in the set.

Default is "no". If the value is "yes", a text node generated by instantiating the <xsl:value-of> element will be output without any escaping. For example, the following generates the single character "<".

<xsl:value-of disable-output-escaping="yes" select="string('&lt;')"/>
Because disable-output-escaping="yes" can be used to generate non-well-formed documents, it should be used with caution. Output that is not well-formed can generate errors in certain circumstances. For example, transformNodeToObject to an XML document requires that the result be well-formed, and thus might not complete if disable-output-escaping has affected the well-formedness of the document. Consider disable-output-escaping="yes" an advanced feature, to be used only when the potential dangers are understood.


Number of occurrences


Parent elements

xsl:attribute, xsl:comment, xsl:copy, xsl:element, xsl:fallback, xsl:for-each, xsl:if, xsl:message, xsl:otherwise, xsl:param, xsl:processing-instruction, xsl:template, xsl:variable, xsl:when, xsl:with-param, output elements

Child elements

(No child elements)

The <xsl:value-of> element inserts a text string representing the value of the first element (in document order) specified by the select attribute.

If the XML Path Language (XPath) expression returns more than a single node, the <xsl:value-of> element returns the text of the first node returned (equivalent to the XMLDOMNode object's selectSingleNode method). If the node returned is an element with substructure, <xsl:value-of> returns the concatenated text nodes of that element's subtree with the markup removed.

The following XSLT file creates a <p> element from a <person> element with <given-name> and <family-name> child elements. The <p> element will contain the string value of the first <given-name> child element of the current node, followed by a space and the string value of the first <family-name> child element of the current node.

XML File (family.xml)

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="family.xsl"?>
    <given-name age="10">Fred</given-name>
    <given-name age="13">Jill</given-name>

XSLT File (family.xsl)

<?xml version='1.0'?>
<xsl:stylesheet version="1.0"

<xsl:template match="person">
    <xsl:value-of select="given-name"/>
    <xsl:text> </xsl:text>
    <xsl:value-of select="family-name"/>



This is the formatted output:

Fred Smith

Jill Jones

This is the processor output:

<?xml version="1.0" encoding="UTF-16"?>
  <p>Fred Smith</p>
  <p>Jill Jones</p>

Build Date:

© 2015 Microsoft