O'Reilly logo

XSLT by Doug Tidwell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How Do I Generate Some Text?

You can generate text in your output in several different ways. The simplest way is to use the <xsl:text> element. This element generates text to the output stream automatically. The <xsl:text> element is often necessary because many elements in the XSLT vocabulary can’t contain text.

A second way is to use the <xsl:value-of> element with various string functions. Say we’re going to generate a string that is the concatenation of several items in the current context. Combining <xsl:value-of> with the concat() function allows us to do this. Here’s an example:

<xsl:value-of select="concat('abc ', 'easy as ',123)"/>

This element is replaced with the text “abc easy as 123.”

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required