Causes its content to be output. The main reason for enclosing text within an xsl:text element is to allow whitespace to be output. Whitespace nodes in the stylesheet are ignored unless they appear immediately within an xsl:text element.

Category: instruction
Content: #PCDATA
Permitted parent elements: any XSLT element whose content model is sequence-constructor; any literal result element




If set to yes, special characters such as "<" and "&" will be output as themselves, not as entities. Be aware that in general this can produce non-well-formed XML or HTML. It is useful, however, when generating things such as ASP or JSP pages. Escaping may not be disabled when writing to a result tree fragment. The default is no.


In XSLT 3.0, note that generally text value templates (expressions within curly braces) are NOT recognized within xsl:text. However the standard attribute expand-text can be used to enable their use. Text value templates can be used within an xsl:text element if the nearest ancestor which has an expand-text attribute has the value yes for this attribute. (See xsl:stylesheet for details on the standard attribute expand-text.)

Links to W3C specifications

XSLT 2.0 Specification

XSLT 3.0 Specification

See also