XSLT and Xpath Quick Reference

XSLT and Xpath Quick Reference

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

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    4 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us