XSLT 1.0 Reference

Node Tests

Specifiers

Node Set Functions

String Functions

name

ancestor::

number last()

string string(object?)

node()

following-sibling::

number position()

string concat(string, string, string*)

prefix:name

ancestor-or-self::

number count(node-set)

boolean starts-with(string, string)

text()

namespace::

node-set id(object)

boolean contains(string, string)

*

attribute::

string local-name(node-set?)

string substring-before(string, string)

comment()

parent::

string namespace-uri(node-set?)

string substring-after(string, string)

prefix:*

child::

string name(node-set?)

string substring(string, number, number?)

processing-instruction()

preceding::


number string-length(string?)

processing-instruction(literal)

descendant::


string normalize-space(string?)


preceding-sibling::


string translate(string, string, string)


descendant-or-self::




self::




following::




Boolean Functions

Number Functions

XSLT Functions

Booleans and Numbers

boolean boolean(object)

number number(object?)

node-set document(object, node-set?)

<=,<, >=, > =, != (don't forget to replace < with &lt; and > with &gt;)

boolean not(object)

number sum(node-set)

node-set key(string, object)

and

boolean true()

number floor(number)

string format-number(number, string, string?)

or

boolean false()

number ceiling(number)

node-set current()

-expr

boolean lang(string)

number round(number)

string unparsed-entity-uri(string)

*, div, mod



string generate-id(node-set?)

+, -



object system-property(string)




boolean element-available(string)




boolean function-available(string)



Stylesheet Element

Combining Stylesheets

Whitespace Stripping

Defining Template Rules

<xsl:stylesheet
version="1.0"
id="id"
extension-element-prefixes="tokens"
exclude-result-prefixes="tokens"
xmlns:xsl="http://www.w3.org/1999/XSL/ Transform"
>
xsl:import*, top-level elements
</xsl:stylesheet>

<xsl:include href="uri-reference"/>
<xsl:import href="uri-reference"/>

<xsl:strip-space elements="tokens"/> <xsl:preserve-space
elements="tokens"
/>

<xsl:template
match="pattern"
name="qname"
priority="number" mode="qname"
>
xsl:param* followed by text, literal result elements and/or XSL elements
</xsl:template>

Applying Template Rules

Overriding Template Rules

Named Templates

Namespace Alias

<xsl:apply-templates
select="node-set-exp"
mode="qname"
/>
<xsl:apply-templates select="node-set-exp" mode="qname">
(xsl:sort | xsl:with-param)*
</xsl:apply-templates>

<xsl:apply-imports/>

<xsl:call-template name="qname"/>
<xsl:call-template name="qname">
xsl:with-param*
</xsl:call-template>

<xsl:namespace-alias
result-prefix="prefix|#default"
stylesheet-prefix="prefix|#default"
/>

Creating Elements

Creating Attributes

Named Attribute Sets

Creating Text

<xsl:element
name="{qname}"
namespace="{uri-reference}"
use-attribute-sets="qnames"
>
...
</xsl:element>

<xsl:attribute
name="{qname}"
namespace="{uri-reference}"
>
...
</xsl:attribute>

<xsl:attribute-set
name="qname"
use-attribute-sets="qnames"
>
xsl:attribute*
</xsl:attribute-set>

<xsl:text
disable-output-escaping="yes|no">
#PCDATA
</xsl:text>

Processing Instructions

Creating Comments

Copying

Generating Text

<xsl:processing-instruction name="{ncname}">
...
</xsl:processing-instruction>

<xsl:comment>
...
</xsl:comment>

<xsl:copy
use-attribute-sets="qnames"
>
...
</xsl:copy>

<xsl:value-of
select="string-expr"
disable-output-escaping="yes|no"
/>

Attribute Value Templates

Numbering

Repetition

Conditional Processing

<element attribute="{expr}"/>

<xsl:number
level="single|multiple|any"
count="pattern"
from="pattern"
value="number-expr"
format="{string}"
lang="{nmtoken}"
letter-value="{alphabetic|traditional}"
grouping-separator="{char}"
grouping-size="{number}"
/>

<xsl:for-each
select="node-set-expr"
>
xsl:sort*, ...
</xsl:for-each>

<xsl:if test="boolean-expr">
...
</xsl:if>
<xsl:choose>
<xsl:when test="expr">...</xsl:when>+
<xsl:otherwise>...</xsl:otherwise>?
</xsl:choose>

Sorting

Variables and Parameters

Using Values

Passing Parameters

<xsl:sort
select="string-expr"
lang="{nmtoken}"
data-type="{text|number|qname-but-not- ncname}"
order="{ascending|descending}"
case-order="{upper-first|lower-first}"
/>

<xsl:variable
name="qname"
select="expr"
/>
<xsl:variable name="qname">
...
</xsl:variable>
<xsl:param name="qname" select="expr"/>

<xsl:param name="qname">
...
</xsl:param>

<xsl:copy-of select="expr"/>

<xsl:with-param
name="expr"
select="expr"
/>

<xsl:with-param name="expr">
...
</xsl:with-param>

Keys

Number Formatting

Messages

Fallback

<xsl:key name="qname" match="pattern" use="expr"/>

<xsl:decimal-format
name="qname"
decimal-separator="char"
grouping-separator="char"
infinity="string"
minus-sign="char"
NaN="string"
percent="char"
per-mille="char"
zero-digit="char"
digit="char"
pattern-separator="char"
/>

<xsl:message
terminate="yes|no"
>
...
</xsl:message>

<xsl:fallback>
...
</xsl:fallback>

Output




<xsl:output
method="xml|html|text|qname-but-not-ncname"
version="nmtoken"
encoding="string"
omit-xml-declaration="yes|no"
doctype-public="string"
doctype-system="string"
standalone="yes|no"
indent="yes|no"
cdata-section-elements="qnames"
media-type="string"
/>