Skip to Main Content
XSLT
book

XSLT

by Doug Tidwell
August 2001
Intermediate to advanced content levelIntermediate to advanced
480 pages
11h 16m
English
O'Reilly Media, Inc.
Content preview from XSLT

Name

<xsl:value-of> — Calculates the value of an XPath expression, converts that value to a string, and then writes the value to the result tree.

Category

Instruction

Required Attributes

select

The XPath expression that is evaluated and written to the output document.

Optional Attributes

disable-output-escaping

An attribute that defines whether special characters are escaped when written to the output document. For example, if the literal text contains the character >, it is normally written to the output document as &gt;. If you code disable-output-escaping="yes", the character > is written instead. The XSLT processor uses this attribute only if you use the html or xml output methods. If you use <xsl:output method="test">, the attribute is ignored becasue output escaping is not done for the text output method. See <xsl:text> for a more thorough discussion of the disable-output-escaping attribute.

Content

None. <xsl:value-of> is an empty element.

Appears in

<xsl:value-of> appears inside a template.

Defined in

XSLT section 7.6.1, Generating Text with xsl:value-of.

Example

We’ll use the <xsl:value-of> element to generate some text. Here is our stylesheet:

<?xsl version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:variable name="newline"> <xsl:text> </xsl:text> </xsl:variable> <xsl:template match="/"> <xsl:text>Your document contains</xsl:text> <xsl:value-of select="count(//*)"/> <xsl:text> elements and </xsl:text> <xsl:value-of ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning XSLT

Learning XSLT

Michael Fitzgerald
Inside XSLT

Inside XSLT

Steven Holzner
XSLT Cookbook

XSLT Cookbook

Sal Mangano
XSLT and XPATH: A Guide to XML Transformations

XSLT and XPATH: A Guide to XML Transformations

John Robert Gardner, Zarella L. Rendon

Publisher Resources

ISBN: 0596000537Supplemental ContentCatalog PageErrata