Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
stylesheet | In general, references to the stylesheet mean the principal stylesheet module plus all the stylesheet modules incorporated into it using stylesheet module . |
sequence constructor | A sequence of instructions and literal result elements contained within (that is, that are children of) another XSLT element. Many XSLT elements, such as |
SequenceType | A number of XSLT elements take an as attribute whose value is a SequenceType . This is a sequence type descriptor such as xs:integer* , or node()? , or element(part,*) . The syntax for sequence type descriptors is given in Chapter 11. |
template rule | An match attribute. |
XSLT element | Any of the standard elements in the XSLT namespace listed in this chapter, for example |
The elements in this chapter are listed alphabetically rather than on functional lines, for ease of reference. This is fine when you know what you are looking for, but if you are using this book as your introduction to XSLT, it does create the problem that related things won't be found together. And if you try to read sequentially, you'll start with
So here's an attempt at some kind of ordering and grouping, to suggest which entries you might look at first if you're new to the subject. The following table includes all the more common elements, but leaves out a few that can only be classified as “miscellanous”.
Grouping | Elements |
Elements defining the structure of the stylesheet | |
Elements used to define template rules and functions and control the way they are invoked | |
Elements used to create nodes | |
Elements used to define variables and parameters | |
Elements used to copy information from the source document to the result | |
Elements used for conditional processing and iteration | |
Elements to control sorting, searching, and numbering | |
Elements used to control the output of the stylesheet |
xsl:analyze-string
The
regex
). It is useful where the source document contains text whose structure is not fully marked up using XML elements and attributes, but has its own internal syntax. For example, the value of an attribute might be a list of numbers separated by commas.
I use the term
regex
to refer to regular expressions in this section, because it helps to avoid any confusion with XPath expressions.
Changes in 2.0
This instruction is new in XSLT 2.0.
Format
select = expression
regex = { string }
flags? = { string }>
Position
Attributes
Name | Value | Meaning |
select mandatory | XPath Expression | The input string to be analyzed using the regex. A type error occurs if the value of the expression cannot be converted to a string using the standard conversion rules described on page 505. |
regex mandatory | Attribute value template returning a regular expression, as defined below | The regular expression (regex) used to analyze the string. See warning below regarding curly braces. |
flags optional | Attribute value template returning regex flags, as defined below | Flags controlling how the regex is interpreted. Omitting the attribute is equivalent to supplying a zero-length string (no special flags). |
The construct
expression
(meaning an XPath expression) is defined in Chapter 7.
The syntax of regular expressions permitted in the
regex
attribute is the same as the syntax accepted by the functions
matches()
,
replace()
, and
tokenize()
in XPath 2.0. This is described fully in Chapter 14, and is summarized below. It is based on the syntax used for regular expressions in XML Schema, with some extensions.