Values of elements and attributes

Sometimes it is useful to be able to access the content of an element as a string, regardless of whether the element contains sub-elements or not. Instead of activating templates on the content of the current element, the content can be converted to a string and inserted into the specified output using the Value Of element. This element has a Select attribute, which in the simplest case is used to select the current element (although more advanced options are introduced later). The value '.' refers to the current element. Embedded element markup is ignored:

  <para>All the <emph>text</emph> here is the value</para>


<value-of select="."/>


   All the text here is the value
				

This element can also be used to present ...

Get XSL companion, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.