Jesper Tverskov, Updated: 2011-07-01

XSLT by Example: Elements

1. xsl:analyze-string

mk | 2.0 | ex1

<!-- Category: instruction -->
<xsl:analyze-string select=expression regex={string} flags={string}>
     <!-- Content: (xsl:matching-substring?, xsl:non-matching-substring?, xsl:fallback*) -->
</xsl:analyze-string>

2. xsl:apply-imports

mk | 2.0 1.0 | ex1

<!-- Category: instruction -->
<xsl:apply-imports>
     <!-- Content: xsl:with-param* -->
</xsl:apply-imports>

3. xsl:apply-templates

mk | 2.0 1.0 | ex1 ex2

<!-- Category: instruction -->
<xsl:apply-templates select=expression mode=token>
     <!-- Content: (xsl:sort|xsl:with-param)* -->
</xsl:apply-templates>

4. xsl:attribute

mk | 2.0 1.0 | ex1 ex2

<!-- Category: instruction -->
<xsl:attribute name={qname} namespace={uri-reference} select=expression separator={string} type=qname validation="strict"|"lax"|"preserve"|"strip">
     <!-- Content: sequence-constructor -->
</xsl:attribute>

5. xsl:attribute-set

mk | 2.0 1.0 | ex1

<!-- Category: declaration -->
<xsl:attribute-set name=qname use-attribute-sets=qnames>
     <!-- Content: xsl:attribute* -->
</xsl:attribute-set>

6. xsl:call-template

mk | 2.0 1.0 | ex1

<!-- Category: instruction -->
<xsl:call-template name=qname>
     <!-- Content: xsl:with-param* -->
</xsl:call-template>

7. xsl:character-map

mk | 2.0 | ex1

<!-- Category: declaration -->
<xsl:character-map name=qname use-character-maps=qnames>
     <!-- Content: (xsl:output-character*) -->
</xsl:character-map>

8. xsl:choose

mk | 2.0 1.0 | ex1

<!-- Category: instruction -->
<xsl:choose>
     <!-- Content: (xsl:when+, xsl:otherwise?) -->
</xsl:choose>

9. xsl:comment

mk | 2.0 1.0 | ex1

<!-- Category: instruction -->
<xsl:comment select=expression>
     <!-- Content: sequence-constructor -->
</xsl:comment>

10. xsl:copy

mk | 2.0 1.0 | ex1

<!-- Category: instruction -->
<xsl:copy copy-namespaces="yes"|"no" inherit-namespaces="yes"|"no" use-attribute-sets=qnames type=qname validation="strict"|"lax"|"preserve"|"strip">
     <!-- Content: sequence-constructor -->
</xsl:copy>

11. xsl:copy-of

mk | 2.0 1.0 | ex1

<!-- Category: instruction -->
<xsl:copy-of select=expression copy-namespaces="yes"|"no" type=qname validation="strict"|"lax"|"preserve"|"strip" />

12. xsl:decimal-format

mk | 2.0 1.0 | ex1

<!-- Category: declaration -->
<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 />

13. xsl:document

mk | 2.0 | ex1

<!-- Category: instruction -->
<xsl:document validation="strict"|"lax"|"preserve"|"strip" type=qname>
     <!-- Content: sequence-constructor -->
</xsl:document>

14. xsl:element

mk | 2.0 1.0 | ex1

<!-- Category: instruction -->
<xsl:element name={qname} namespace={uri-reference} inherit-namespaces="yes"|"no" use-attribute-sets=qnames type=qname validation="strict"|"lax"|"preserve"|"strip">
     <!-- Content: sequence-constructor -->
</xsl:element>

15. xsl:fallback

mk | 2.0 1.0 | ex1

<!-- Category: instruction -->
<xsl:fallback>
     <!-- Content: sequence-constructor -->
</xsl:fallback>

16. xsl:for-each

mk | 2.0 1.0 | ex1 ex2 ex3

<!-- Category: instruction -->
<xsl:for-each select=expression>
     <!-- Content: (xsl:sort*, sequence-constructor) -->
</xsl:for-each>

17. xsl:for-each-group

mk | 2.0 | ex1 ex2

<!-- Category: instruction -->
<xsl:for-each-group select=expression group-by=expression group-adjacent=expression group-starting-with=pattern group-ending-with=pattern collation={uri}>
     <!-- Content: (xsl:sort*, sequence-constructor) -->
</xsl:for-each-group>

18. xsl:function

mk | 2.0 | ex1

<!-- Category: declaration -->
<xsl:function name=qname as=sequence-type override="yes"|"no">
     <!-- Content: (xsl:param*, sequence-constructor) -->
</xsl:function>

19. xsl:if

mk | 2.0 1.0 | ex1

<!-- Category: instruction -->
<xsl:if test=expression>
     <!-- Content: sequence-constructor -->
</xsl:if>

20. xsl:import

mk | 2.0 1.0 | ex1

<!-- Category: declaration -->
<xsl:import href=uri-reference />

21. xsl:import-schema

mk | 2.0 | ex1

<!-- Category: declaration -->
<xsl:import-schema namespace=uri-reference schema-location=uri-reference>
     <!-- Content: xs:schema? -->
</xsl:import-schema>

22. xsl:include

mk | 2.0 1.0 | ex1

<!-- Category: declaration -->
<xsl:include href=uri-reference />

23. xsl:key

mk | 2.0 1.0 | ex1

<!-- Category: declaration -->
<xsl:key name=qname match=pattern use=expression collation=uri>
     <!-- Content: sequence-constructor -->
</xsl:key>

24. xsl:matching-substring

mk | 2.0

<!-- Category: (used inside xsl:analyze-string) -->
<xsl:matching-substring>
     <!-- Content: sequence-constructor -->
</xsl:matching-substring>

25. xsl:message

mk | 2.0 1.0 | ex1

<!-- Category: instruction -->
<xsl:message select=expression terminate={"yes"|"no"}>
     <!-- Content: sequence-constructor -->
</xsl:message>

26. xsl:namespace

mk | 2.0 | ex1 ex2 ex3

<!-- Category: instruction -->
<xsl:namespace name={ncname} select=expression>
     <!-- Content: sequence-constructor -->
</xsl:namespace>

27. xsl:namespace-alias

mk | 2.0 1.0 | ex1

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

28. xsl:next-match

mk | 2.0 | ex1

<!-- Category: instruction -->
<xsl:next-match>
     <!-- Content: (xsl:with-param|xsl:fallback)* -->
</xsl:next-match>

29. xsl:non-matching-substring

mk | 2.0

<!-- Category: (used inside xsl:analyze-string) -->
<xsl:non-matching-substring>
     <!-- Content: sequence-constructor -->
</xsl:non-matching-substring>

30. xsl:number

mk | 2.0 1.0 | ex1 ex2 ex3 ex4

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

31. xsl:otherwise

mk | 2.0 1.0

<!-- Category: (used as part of xsl:choose) -->
<xsl:otherwise>
     <!-- Content: sequence-constructor -->
</xsl:otherwise>

32. xsl:output

mk | 2.0 1.0 | ex1

<!-- Category: declaration -->
<xsl:output name=qname method="xml"|"html"|"xhtml"|"text"|qname-but-not-ncname byte-order-mark="yes"|"no" cdata-section-elements=qnames doctype-public=string doctype-system=string encoding=string escape-uri-attributes="yes"|"no" include-content-type="yes"|"no" indent="yes"|"no" media-type=string normalization-form="NFC"|"NFD"|"NFKC"|"NFKD"|"fully-normalized"|"none"|nmtoken omit-xml-declaration="yes"|"no" standalone="yes"|"no"|"omit" undeclare-prefixes="yes"|"no" use-character-maps=qnames version=nmtoken />

33. xsl:output-character

mk | 2.0

<!-- Category: (used as part of xsl:character-map) -->
<xsl:output-character character=char string=string />

34. xsl:param

mk | 2.0 1.0 | ex1

<!-- Category: declaration --> <!-- Category: instruction (first child of xsl:template) -->
<xsl:param name=qname select=expression as=sequence-type required="yes"|"no" tunnel="yes"|"no">
     <!-- Content: sequence-constructor -->
</xsl:param>

35. xsl:perform-sort

mk | 2.0 | ex1

<!-- Category: instruction -->
<xsl:perform-sort select=expression>
     <!-- Content: (xsl:sort+, sequence-constructor) -->
</xsl:perform-sort>

36. xsl:preserve-space

mk | 2.0 1.0 | ex1

<!-- Category: declaration -->
<xsl:preserve-space elements=tokens />

37. xsl:processing-instruction

mk | 2.0 1.0 | ex1

<!-- Category: instruction -->
<xsl:processing-instruction name={ncname} select=expression>
     <!-- Content: sequence-constructor -->
</xsl:processing-instruction>

38. xsl:result-document

mk | 2.0 | ex1

<!-- Category: instruction -->
<xsl:result-document format={qname} href={uri-reference} validation="strict"|"lax"|"preserve"|"strip" type=qname method={"xml"|"html"|"xhtml"|"text"|qname-but-not-ncname} byte-order-mark={"yes"|"no"} cdata-section-elements={qnames} doctype-public={string} doctype-system={string} encoding={string} escape-uri-attributes={"yes"|"no"} include-content-type={"yes"|"no"} indent={"yes"|"no"} media-type={string} normalization-form={"NFC"|"NFD"|"NFKC"|"NFKD"|"fully-normalized"|"none"|nmtoken} omit-xml-declaration={"yes"|"no"} standalone={"yes"|"no"|"omit"} undeclare-prefixes={"yes"|"no"} use-character-maps=qnames output-version={nmtoken}>
     <!-- Content: sequence-constructor -->
</xsl:result-document>

39. xsl:sequence

mk | 2.0 | ex1

<!-- Category: instruction -->
<xsl:sequence select=expression>
     <!-- Content: xsl:fallback* -->
</xsl:sequence>

40. xsl:sort

mk | 2.0 1.0 | ex1 ex2

<!-- Category: (used inside xsl:for-each, xsl:for-each-group, xsl:apply-templates, xsl:perform-sort) -->
<xsl:sort select=expression lang={nmtoken} order={"ascending"|"descending"} collation={uri} stable={"yes"|"no"} case-order={"upper-first"|"lower-first"} data-type={"text"|"number"|qname-but-not-ncname}>
     <!-- Content: sequence-constructor -->
</xsl:sort>

41. xsl:strip-space

mk | 2.0 1.0 | ex1

<!-- Category: declaration -->
<xsl:strip-space elements=tokens />

42. xsl:stylesheet

mk | 2.0 1.0 | ex1

<!-- Category: outermost element -->
<xsl:stylesheet id=id extension-element-prefixes=tokens exclude-result-prefixes=tokens version=number xpath-default-namespace=uri default-validation="preserve"|"strip" default-collation=uri-list input-type-annotations="preserve"|"strip"|"unspecified">
     <!-- Content: (xsl:import*, other-declarations) -->
</xsl:stylesheet>

43. xsl:template

mk | 2.0 1.0 | ex1

<!-- Category: declaration -->
<xsl:template match=pattern name=qname priority=number mode=tokens as=sequence-type>
     <!-- Content: (xsl:param*, sequence-constructor) -->
</xsl:template>

44. xsl:text

mk | 2.0 1.0 | ex1

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

45. xsl:transform

[Alias for xsl:stylesheet. Almost never used.]

<!-- Category: outermost element -->
<xsl:transform id=id extension-element-prefixes=tokens exclude-result-prefixes=tokens version=number xpath-default-namespace=uri default-validation="preserve"|"strip" default-collation=uri-list input-type-annotations="preserve"|"strip"|"unspecified">
     <!-- Content: (xsl:import*, other-declarations) -->
</xsl:transform>

46. xsl:value-of

mk | 2.0 1.0 | ex1

<!-- Category: instruction -->
<xsl:value-of select=expression separator={string} disable-output-escaping="yes"|"no">
     <!-- Content: sequence-constructor -->
</xsl:value-of>

47. xsl:variable

mk | 2.0 1.0 | ex1

<!-- Category: declaration --> <!-- Category: instruction -->
<xsl:variable name=qname select=expression as=sequence-type>
     <!-- Content: sequence-constructor -->
</xsl:variable>

48. xsl:when

mk | 2.0 1.0

<!-- Category: (used as part of xsl:choose) -->
<xsl:when test=expression>
     <!-- Content: sequence-constructor -->
</xsl:when>

49. xsl:with-param

mk | 2.0 1.0 | ex1

<!-- Category: (used inside xsl:apply-templates, xsl:call:template) -->
<xsl:with-param name=qname select=expression as=sequence-type tunnel="yes"|"no">
     <!-- Content: sequence-constructor -->
</xsl:with-param>

First published: 2009-03-12