XML & XSL - xsl:value-of


xsl:value-of replaces the value of the selected text into in the output.

Syntax

<xsl:value-of select="pattern">

Attributes

Parent Elements

Child Elements

None.

Purpose

xsl:value-of inserts a text string for the value of the first element found in the document specified by the select attribute. Much like an SQL SELECT DISTINCT statement.

xsl:value-of is the equivalent of the DOM Node object's selectSingleNode method. If the node returned is an element with substructure then xsl:value-of returns the concatenated text nodes of the element subtree with the markup characters removed, for instance the tag delimiters < and >.

The example below shows the replacement into the output of the name tag.

<xsl:element name="INPUT">
	<xsl:attribute name="VALUE"><xsl:value-of select="name"/></xsl:attribute>
	<xsl:attribute name="SIZE">35</xsl:attribute>
</xsl:element>

HTML Equivalent

<INPUT VALUE="name" SIZE="35">

Global Population Econometrics Example

Click here to view an example.