XSLT for Dummies Cheat Sheet | |
XSLT For Dummies | |
by Richard Wagner | |
Hungry Minds 2002 |
XSLT ElementsNote: Common syntax section lists the element with the most commonly used attributes, but not all of them. Also, italicized attributes are optional. Primaryxsl:apply-templatesDefines 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"/> xsl:call-templateCalls a named template. May contain xsl: with-param elements. Common Syntax<xsl:call-template name="templatename"/> xsl:copyPerforms 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> xsl:copy-ofPerforms 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"/> xsl:numberWrites 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}"/> xsl:outputSpecifies 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: sortSorts 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"/> xsl:stylesheetDefines 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> xsl:templateDefines a template rule for the result tree. Common Syntax<xsl:template name="name" match=" pattern"> <! Template body > </xsl:template> xsl:textWrites literal text to the result tree. Common Syntax<xsl:text> <! Text > </xsl:text> xsl:transformDefines 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> xsl:value-ofInserts the value of the expression into the result tree. Common Syntax<xsl:value-of select="expression"/> XPath Shorthand
|