Location Paths [XPath §2]                                             XPath Operators                                                                                                XSLT Functions [§12, §15]
Optional ‘/’, zero or more location steps, separated by ‘/’                                                                                                                          node-set document(object, node-set?)
                                                                      Parentheses may be used for grouping.
                                                                                                                                                                                     node-set key(string, object)
Location Steps [XPath §2.1]                                           Node-sets [XPath §3.3]                                                                                         string format-number(number, string, string ?)
Axis specifier , node test, zero or more predicates
Axis Specifiers [XPath §2.2]
                                                                      |              [expr]        /                //
                                                                                                                                               XSLT 1.0                              node-set current()
                                                                                                                                                                                     string unparsed-entity-uri(string)
                                                                      Boolea ns [XPath §3.4]
ancestor::
ancestor-or-self::
                              following-sibling::
                              namespace::
                                                                      <=, <, >=, >   =, !=         and              or                         &                                     string generate-id(node-set?)
                                                                                                                                                                                     object system-property(string)
                                                                      Numbers [XPath §3.5]                                                                                           boolean element-available(string)
attribute::
child::
                              parent::
                              preceding::                             -expr          *, div, mod   +, -                                        XPath 1.0                             boolean function-available(string)
descendant::                  preceding-sibling::
descendant-or-self::
following::
                              self::
                                                                      XPath Core Function Library                                              Quick Reference                       Node Types [XPath §5]
                                                                                                                                                                                     Root                           Processing Instruction
                                                                                                                                                                                     Element                        Comment
Node Tests [XPath §2.3]                                               Node Set Functions [XPath §4.1]                                                                                Attribute                      Text
name                          node()                                  number last()                                                                                                  Namespace
prefix:name                   text()                                  number position()
*                             comment()                               number count(node-set)                                                                                         Object Types [§11.1, XPath §1]
prefix:*                      processing-instruction()                node-set id(object)
                                                                      string local-name(node-set?)                                                                                   boolean        True or false
                              processing-
                              instruction(literal)                    string namespace-uri(node-set?)                                                                                number         Floating-point number
                                                                      string name(node-set?)
Abbreviated Syntax for Location Paths                                                                                                                                                string         UCS characters
                                                                      String Functio ns [XPath §4.2]                                                                                 node-set       Set of nodes selected by a path
(nothing)       child::                                               string string(object?)
                                                                      string concat(string, string, string*)                                                                         Result tree    XSLT only. Fragment of the result tree
@               attribute::
                                                                      boolean starts-with(string, string)                                                                            fragment
//              /descendant-or-self::node()/                          boolean contains(string, string)
.               self::node()                                          string substring-before(string, string)                                                                        Expression Context [§4, XPath §1]
                                                                      string substring-after(string, string)                                                                         Context node (a node)
..              parent::node()
                                                                      string substring(string, number, number?)                                                                      Context position (a number)
/               Node tree root                                        number string-length(string?)                                                                                  Context size (a number)
                                                                                                                                               Mulberry Technologies, Inc.
                                                                      string normalize-space(string ?)                                                                               Variable bindings in scope
Predicate [XPath §2.4]                                                string translate(string, string, string)
                                                                                                                                               17 West Jefferson Street, Suite 207
                                                                                                                                               Rockville, MD 20850 USA               Namespace declarations in scope
[expr]
                                                                                                                                                                                     Function library
Variable Reference [XPath §3.7]                                       Boolea n Functions [XPath §4.3]                                          Phone: +1 301/315-9631
                                                                      boolean boolean(object)                                                  Fax: +1 301/315-8285
$qname                                                                                                                                         info@mulberrytech.com
                                                                                                                                                                                     Built-in Template Rules [§5.8]
                                                                      boolean not(object)                                                                                            <xsl:template match="*|/">
Literal Result Elements [§7.1.1]                                      boolean true()                                                           http://www.mulberrytech.com
                                                                                                                                                                                         <xsl:apply-templates/>
Any element not in the xsl: namespace and not an extension            boolean false()                                                                                                </xsl:template>
element                                                               boolean lang(string)
                                                                                                                                                                                     <xsl:template match="*|/" mode="m">
                                                                      Number Functions [XPath §4.4]                                                                                      <xsl:apply-templates mode="m"/>
                                                                      number number(object?)                                                                                         </xsl:template>
XSLT                                                                  number sum(node-set)
http://www.w3.org/TR/xslt                                                                                                                                                            <xsl:template match="text()|@*">
                                                                      number floor(number)                                                                                               <xsl:value-of select="."/>
XPath                                                                 number ceiling(number)                                                                                         </xsl:template>
http://www.w3.org/TR/xpath                                            number round(number)
                                                                                                                                                                                     <xsl:template
XSL-List                                                                                                                                                                                 match="processing-instruction()|comment()"/>
http://www.mulberrytech.com/xsl/xsl-list/                                                                                                                                            Built-in template rule for namespaces is to do nothing




                                 © 2000 Mulberry Technologies, Inc.                            © 2000 Mulberry Technologies, Inc. (20051123)                                                                        © 2000 Mulberry Technologies, Inc.
XSLT Elements                                                     Creating Attributes [§7.1.3]                                     Sorting [§10]                                                 Key
                                                                    <xsl:attribute name="{qname}"                                    <xsl:sort select="string-expr" lang="{nmtoken}"             xsl:stylesheet
Styleshe et Element [§2.2]                                                                                                                                                                                        Element
                                                                       namespace="{uri-reference}">...</xsl:attribute>                  data-type="{text|number|qname-but-not-
  <xsl:stylesheet version="1.0" id="id"                                                                                                 ncname}" order="{ascending|descending}"                  version=         Required attribute
      extension-element-prefixes="tokens"                         Named Attribute Sets [§7.1.4]                                         case-order="{upper-first|lower-first}"/>                 version=         Optional attribute
      exclude-result-prefixes="tokens"                              <xsl:attribute-set name="qname"
      xmlns:xsl="http://www.w3.org/1999/XSL/                           use-attribute-sets="qnames">                                Variables and Parameters [§11]                                {expr}           Attribute value template. Text between
      Transform"> xsl:import*, top-level elements                      xsl:attribute* </xsl:attribute-set>                           <xsl:variable name="qname" select="expr"/>                                   any { and } is evaluated as an
  </xsl:stylesheet>                                                                                                                  <xsl:variable name="qname">...</xsl:variable>                                expression. Attribute value must
                                                                  Creating Text [§7.2]
                                                                    <xsl:text disable-output-escaping="yes|no">                      <xsl:param name="qname" select="expr"/>                                      evaluate to indicated attribute type.
  xsl:transform is a synonym for xsl:stylesheet
                                                                       #PCDATA </xsl:text>                                           <xsl:param name="qname">...</xsl:param>                     …                Anything allowed in a template
Combining Styleshe ets [§2.6]                                                                                                                                                                    |
                                                                  Processing Instructions [§7.3]                                   Using Values [§11.3]                                                           Separates alternative values
  <xsl:include href="uri-reference"/>
                                                                    <xsl:processing-instruction name="{ncname}">                     <xsl:copy-of select="expr"/>                                ?                Zero or one occurrences
  <xsl:import href="uri-reference"/>
                                                                       ...</xsl:processing-instruction>                            Passing Parameters [§11.6]                                    *                Zero or more occurrences
Whitespace Stripping [§3.4]                                       Creating Comm ents [§7.4]                                          <xsl:with-param name="expr" select="expr"/>                 +                One or more occurrences
  <xsl:strip-space elements="tokens"/>                                                                                               <xsl:with-param name="expr">...</xsl:with-
                                                                    <xsl:comment>...</xsl:comment>                                                                                               #PCDATA          Character data
  <xsl:preserve-space elements="tokens"/>                                                                                               param>
                                                                  Copying [§7.5]                                                                                                                 Attribute Value Types
Defining Template Rules [§5.3]                                      <xsl:copy use-attribute-sets="qnames">                         Keys [§12.2]
  <xsl:template match="pattern" name="qname"                           ...</xsl:copy>                                                <xsl:key name="qname" match="pattern"                       1.0            Literal value
     priority="number" mode="qname">                                                                                                    use="expr"/>                                             boolean-expr   Expression returning boolean value
     xsl:param* followed by text, literal result elements         Gen erating Text [§7.6.1]
                                                                    <xsl:value-of select="string-expr"                             Number Formatting [§12.3]                                     char           Single character
     and/or XSL elements </xsl:template>
                                                                       disable-output-escaping="yes|no"/>                            <xsl:decimal-format name="qname"                            expr           Expression
Applying Template Rules [§5.4]                                                                                                          decimal-separator="char"
  <xsl:apply-templates select="node-set-exp"                      Attribute Value Templates [§7.6.2]                                    grouping-separator="char" infinity="string"              id             XML name used as identifier
     mode="qname"/>                                                 <element attribute="{expr}"/>                                       minus-sign="char" NaN="string"                           ncname         XML name not containing a colon (:)
  <xsl:apply-templates select="node-set-exp"                      Numbering [§7.7]                                                      percent="char" per-mille="char"                          node-set-expr Expression returning a node set
     mode="qname">                                                  <xsl:number level="single|multiple|any"                             zero-digit="char" digit="char"
                                                                                                                                                                                                 number-expr    Expression returning a number
     (xsl:sort | xsl:with-param)* </xsl:apply-templates>               count="pattern" from="pattern"                                   pattern-separator="char"/>
                                                                                                                                                                                                 pattern        XSLT pattern
Overriding Template Rules [§5.6]                                       value="number-expr" format="{string}"                       Messag es [§13]
                                                                       lang="{nmtoken}"                                                                                                          prefix         Namespace prefix
  <xsl:apply-imports/>                                                                                                               <xsl:message terminate="yes|no">
                                                                       letter-value="{alphabetic|traditional}"                          ...</xsl:message>                                        qname          Namespace-qualified XML name
Named Templates [§6]                                                   grouping-separator="{char}"                                                                                                              comprising local part and optional
  <xsl:call-template name="qname"/>                                    grouping-size="{number}"/>                                  Fallback [§15]                                                               prefix
  <xsl:call-template name="qname">                                                                                                   <xsl:fallback>...</xsl:fallback>
     xsl:with-param* </xsl:call-template>
                                                                  Repetition [§8]                                                                                                                qname-but-not- Namespace-qualified name comprising
                                                                    <xsl:for-each select="node-set-expr">                          O utput [§16]                                                 ncname         local part and prefix
Namespace Alias [§7.1.1]                                               xsl:sort*, ...</xsl:for-each>                                 <xsl:output                                                 token          Meaning varies with context. See Rec.
  <xsl:namespace-alias result-                                                                                                          method="xml|html|text|qname-but-not-ncname"
     prefix="prefix|#default"
                                                                  Co nditional Processing [§9]                                          version="nmtoken" encoding="string"                      uri-reference  Reference to Universal Resource
     stylesheet-prefix="prefix|#default"/>                          <xsl:if test="boolean-expr">...</xsl:i f>                           omit-xml-declaration="yes|no"                                           Identifier
                                                                    <xsl:choose>                                                        doctype-public="string" doctype-
Creating Elements [§7.1.2]                                              <xsl:when test="expr">...</xsl:when> +                          system="string" standalone="yes|no"
  <xsl:element name="{qname}"                                           <xsl:otherwise>...</xsl:otherwise> ?                            indent="yes|no"
     namespace="{uri-reference}"                                    </xsl:choose>                                                       cdata-section-elements="qnames"
     use-attribute-sets="qnames">...</xsl:element>                                                                                      media-type="string"/>




                             © 2000 Mulberry Technologies, Inc.                               © 2000 Mulberry Technologies, Inc.                            © 2000 Mulberry Technologies, Inc.                                 © 2000 Mulberry Technologies, Inc.

XSLT 1 and XPath Quick Reference (from mulberrytech.com)

  • 1.
    Location Paths [XPath§2] XPath Operators XSLT Functions [§12, §15] Optional ‘/’, zero or more location steps, separated by ‘/’ node-set document(object, node-set?) Parentheses may be used for grouping. node-set key(string, object) Location Steps [XPath §2.1] Node-sets [XPath §3.3] string format-number(number, string, string ?) Axis specifier , node test, zero or more predicates Axis Specifiers [XPath §2.2] | [expr] / // XSLT 1.0 node-set current() string unparsed-entity-uri(string) Boolea ns [XPath §3.4] ancestor:: ancestor-or-self:: following-sibling:: namespace:: <=, <, >=, > =, != and or & string generate-id(node-set?) object system-property(string) Numbers [XPath §3.5] boolean element-available(string) attribute:: child:: parent:: preceding:: -expr *, div, mod +, - XPath 1.0 boolean function-available(string) descendant:: preceding-sibling:: descendant-or-self:: following:: self:: XPath Core Function Library Quick Reference Node Types [XPath §5] Root Processing Instruction Element Comment Node Tests [XPath §2.3] Node Set Functions [XPath §4.1] Attribute Text name node() number last() Namespace prefix:name text() number position() * comment() number count(node-set) Object Types [§11.1, XPath §1] prefix:* processing-instruction() node-set id(object) string local-name(node-set?) boolean True or false processing- instruction(literal) string namespace-uri(node-set?) number Floating-point number string name(node-set?) Abbreviated Syntax for Location Paths string UCS characters String Functio ns [XPath §4.2] node-set Set of nodes selected by a path (nothing) child:: string string(object?) string concat(string, string, string*) Result tree XSLT only. Fragment of the result tree @ attribute:: boolean starts-with(string, string) fragment // /descendant-or-self::node()/ boolean contains(string, string) . self::node() string substring-before(string, string) Expression Context [§4, XPath §1] string substring-after(string, string) Context node (a node) .. parent::node() string substring(string, number, number?) Context position (a number) / Node tree root number string-length(string?) Context size (a number) Mulberry Technologies, Inc. string normalize-space(string ?) Variable bindings in scope Predicate [XPath §2.4] string translate(string, string, string) 17 West Jefferson Street, Suite 207 Rockville, MD 20850 USA Namespace declarations in scope [expr] Function library Variable Reference [XPath §3.7] Boolea n Functions [XPath §4.3] Phone: +1 301/315-9631 boolean boolean(object) Fax: +1 301/315-8285 $qname info@mulberrytech.com Built-in Template Rules [§5.8] boolean not(object) <xsl:template match="*|/"> Literal Result Elements [§7.1.1] boolean true() http://www.mulberrytech.com <xsl:apply-templates/> Any element not in the xsl: namespace and not an extension boolean false() </xsl:template> element boolean lang(string) <xsl:template match="*|/" mode="m"> Number Functions [XPath §4.4] <xsl:apply-templates mode="m"/> number number(object?) </xsl:template> XSLT number sum(node-set) http://www.w3.org/TR/xslt <xsl:template match="text()|@*"> number floor(number) <xsl:value-of select="."/> XPath number ceiling(number) </xsl:template> http://www.w3.org/TR/xpath number round(number) <xsl:template XSL-List match="processing-instruction()|comment()"/> http://www.mulberrytech.com/xsl/xsl-list/ Built-in template rule for namespaces is to do nothing © 2000 Mulberry Technologies, Inc. © 2000 Mulberry Technologies, Inc. (20051123) © 2000 Mulberry Technologies, Inc.
  • 2.
    XSLT Elements Creating Attributes [§7.1.3] Sorting [§10] Key <xsl:attribute name="{qname}" <xsl:sort select="string-expr" lang="{nmtoken}" xsl:stylesheet Styleshe et Element [§2.2] Element namespace="{uri-reference}">...</xsl:attribute> data-type="{text|number|qname-but-not- <xsl:stylesheet version="1.0" id="id" ncname}" order="{ascending|descending}" version= Required attribute extension-element-prefixes="tokens" Named Attribute Sets [§7.1.4] case-order="{upper-first|lower-first}"/> version= Optional attribute exclude-result-prefixes="tokens" <xsl:attribute-set name="qname" xmlns:xsl="http://www.w3.org/1999/XSL/ use-attribute-sets="qnames"> Variables and Parameters [§11] {expr} Attribute value template. Text between Transform"> xsl:import*, top-level elements xsl:attribute* </xsl:attribute-set> <xsl:variable name="qname" select="expr"/> any { and } is evaluated as an </xsl:stylesheet> <xsl:variable name="qname">...</xsl:variable> expression. Attribute value must Creating Text [§7.2] <xsl:text disable-output-escaping="yes|no"> <xsl:param name="qname" select="expr"/> evaluate to indicated attribute type. xsl:transform is a synonym for xsl:stylesheet #PCDATA </xsl:text> <xsl:param name="qname">...</xsl:param> … Anything allowed in a template Combining Styleshe ets [§2.6] | Processing Instructions [§7.3] Using Values [§11.3] Separates alternative values <xsl:include href="uri-reference"/> <xsl:processing-instruction name="{ncname}"> <xsl:copy-of select="expr"/> ? Zero or one occurrences <xsl:import href="uri-reference"/> ...</xsl:processing-instruction> Passing Parameters [§11.6] * Zero or more occurrences Whitespace Stripping [§3.4] Creating Comm ents [§7.4] <xsl:with-param name="expr" select="expr"/> + One or more occurrences <xsl:strip-space elements="tokens"/> <xsl:with-param name="expr">...</xsl:with- <xsl:comment>...</xsl:comment> #PCDATA Character data <xsl:preserve-space elements="tokens"/> param> Copying [§7.5] Attribute Value Types Defining Template Rules [§5.3] <xsl:copy use-attribute-sets="qnames"> Keys [§12.2] <xsl:template match="pattern" name="qname" ...</xsl:copy> <xsl:key name="qname" match="pattern" 1.0 Literal value priority="number" mode="qname"> use="expr"/> boolean-expr Expression returning boolean value xsl:param* followed by text, literal result elements Gen erating Text [§7.6.1] <xsl:value-of select="string-expr" Number Formatting [§12.3] char Single character and/or XSL elements </xsl:template> disable-output-escaping="yes|no"/> <xsl:decimal-format name="qname" expr Expression Applying Template Rules [§5.4] decimal-separator="char" <xsl:apply-templates select="node-set-exp" Attribute Value Templates [§7.6.2] grouping-separator="char" infinity="string" id XML name used as identifier mode="qname"/> <element attribute="{expr}"/> minus-sign="char" NaN="string" ncname XML name not containing a colon (:) <xsl:apply-templates select="node-set-exp" Numbering [§7.7] percent="char" per-mille="char" node-set-expr Expression returning a node set mode="qname"> <xsl:number level="single|multiple|any" zero-digit="char" digit="char" number-expr Expression returning a number (xsl:sort | xsl:with-param)* </xsl:apply-templates> count="pattern" from="pattern" pattern-separator="char"/> pattern XSLT pattern Overriding Template Rules [§5.6] value="number-expr" format="{string}" Messag es [§13] lang="{nmtoken}" prefix Namespace prefix <xsl:apply-imports/> <xsl:message terminate="yes|no"> letter-value="{alphabetic|traditional}" ...</xsl:message> qname Namespace-qualified XML name Named Templates [§6] grouping-separator="{char}" comprising local part and optional <xsl:call-template name="qname"/> grouping-size="{number}"/> Fallback [§15] prefix <xsl:call-template name="qname"> <xsl:fallback>...</xsl:fallback> xsl:with-param* </xsl:call-template> Repetition [§8] qname-but-not- Namespace-qualified name comprising <xsl:for-each select="node-set-expr"> O utput [§16] ncname local part and prefix Namespace Alias [§7.1.1] xsl:sort*, ...</xsl:for-each> <xsl:output token Meaning varies with context. See Rec. <xsl:namespace-alias result- method="xml|html|text|qname-but-not-ncname" prefix="prefix|#default" Co nditional Processing [§9] version="nmtoken" encoding="string" uri-reference Reference to Universal Resource stylesheet-prefix="prefix|#default"/> <xsl:if test="boolean-expr">...</xsl:i f> omit-xml-declaration="yes|no" Identifier <xsl:choose> doctype-public="string" doctype- Creating Elements [§7.1.2] <xsl:when test="expr">...</xsl:when> + system="string" standalone="yes|no" <xsl:element name="{qname}" <xsl:otherwise>...</xsl:otherwise> ? indent="yes|no" namespace="{uri-reference}" </xsl:choose> cdata-section-elements="qnames" use-attribute-sets="qnames">...</xsl:element> media-type="string"/> © 2000 Mulberry Technologies, Inc. © 2000 Mulberry Technologies, Inc. © 2000 Mulberry Technologies, Inc. © 2000 Mulberry Technologies, Inc.