Book HomeXSLSearch this book

D.12. 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."



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.