XSLT for Dummies Cheat Sheet

xslt for dummies
XSLT for Dummies Cheat Sheet
XSLT For Dummies
by Richard Wagner
Hungry Minds 2002

XSLT Elements

Note: Common syntax section lists the element with the most commonly used attributes, but not all of them. Also, italicized attributes are optional.



Defines the node set to be processed by the current element. If the select attribute is defined, then only the result of that expression will be processed. If select is not defined, then the current node and all child nodes will be processed.

Common Syntax
 <xsl:apply-templates  select= "expression"/>  


Calls a named template. May contain xsl: with-param elements.

Common Syntax
 <xsl:call-template name="templatename"/> 


Performs a literal copy of the current node to the result tree without making any conversions. No child nodes or attributes are copied .

Common Syntax
 <xsl:copy> <! Template body > </xsl:copy> 


Performs a literal copy of the current node to the result tree, but unlike xsl:copy , it does copy child nodes and attributes.

Common Syntax
 <xsl:copy-of select="expression"/> 


Writes a formatted number to the result tree.

Common Syntax
 <xsl:number  level="singlemultipleany" count="pattern" from="pattern" value="expression" format= "{formatstring}" letter- value="{alphabetictraditional}" grouping-separator="{character}" grouping-size="{number}"/>  


Specifies the format of the output document.

Common Syntax
 <xsl:output  method="xmlhtmltextname" version="version" encoding="text" omit-xml- declaration="yesno" standalone="yesno" indent="yesno"/>  

xsl: sort

Sorts a node set. Valid only as a child of xsl: for-each and xsl:apply-templates elements.

Common Syntax
 <xsl:sort select="expression"  order= "ascendingdescending" case- order="upper-firstlower-first"/>  


Defines an XSLT stylesheet. Same as xsl: transform element.

Common Syntax
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/ Transform"> <! Stylesheet content > </xsl:stylesheet> 


Defines a template rule for the result tree.

Common Syntax
 <xsl:template name="name" match=" pattern"> <! Template body > </xsl:template> 


Writes literal text to the result tree.

Common Syntax
 <xsl:text> <! Text > </xsl:text> 


Defines an XSLT stylesheet. Same as xsl:stylesheet element.

Common Syntax
 <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/ XSL/Transform"> <! Content > </xsl:transform> 


Inserts the value of the expression into the result tree.

Common Syntax
 <xsl:value-of select="expression"/> 

XPath Shorthand







When no axis is defined, a value of child:: is assumed.

match="book" is the same as match="child::book"



Selects an attribute of the context node

select="@id" is the same as select="attribute::id"



Selects the context node.

.//book is the same as self::node()/ descendant-or-self::node()/book



Selects the parent of the

../book is the same as context node. parent::node()/book


/descendant-or- self::node()/

Searches the entire source tree for a specific node set either by name or by type.

//title is the same as /descendant-or- self::node()/title

2000-2002    Feedback

XSLT For Dummies
XSLT for Dummies
ISBN: 0764536516
EAN: 2147483647
Year: 2002
Pages: 148

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net