warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in C:\inetpub\Websites\DevGuru\www\includes\common.inc(1762) : eval()'d code on line 1.

XSLT » Elements » xsl:text

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

The xsl:text element is used to add literal text to the output. This element cannot contain any other XSL elements. It can only contain text.

Normally, any text that occurs in a stylesheet will be copied to the output regardless if it is enclosed by an xsl:text element. However, there are two primary reasons for using the xsl:text element:

  • The first is to control white-space. Extra white-space is preserved by using this element. In other words, a text will be displayed as it really is without any extra white-spaces being removed.

  • The second is to handle special characters such as an ampersand (&) or a greater-than sign (>). For example, you may wish a &gt; to be displayed as a >. This is referred to as controlling output escaping.

    This is not a self-closing element. The separate closing element is mandatory.


    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html" />
    <xsl:template match="/">
    <xsl:text>The DevGuru Staff Members are </xsl:text>
    <xsl:for-each select="devguru_staff/programmer">
    <xsl:value-of select="name" />
    <xsl:if test="position()!=last()">
    <xsl:text>, </xsl:text>
    <xsl:if test="position()=last()-1">
    <xsl:text> and </xsl:text>
    <xsl:if test="position()=last()">
    The DevGuru Staff Members are Bugs Bunny, Daisy Duck, Minnie Mouse, Pluto, Porky Pig, and Road Runner!

    This is the code for xslt_example_text.xsl.
    We use the DevGuru Staff List XML file for our example with the following header:
    <?xml-stylesheet type="text/xsl" href="xslt_example_text.xsl"?>

    Language(s): XSLT

    See Also: