Your SlideShare is downloading. ×
Xsl Tand X Path Quick Reference
Xsl Tand X Path Quick Reference
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Xsl Tand X Path Quick Reference


Published on

  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


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