ELTRENO.COM

Home

PHP

XSLT

JavaScript

ActionScript

MySQL

Unix

VI

Git

React

Day


Cheat sheets

webmasterworld

w3schools

w3c

php

mysql

Validate XHTML

Links

 

XSLT CheatSheet

operators

xpath & functions

xpath axes

xsl:apply-templates

xsl:attribute

xsl:call-template

xsl:choose

xsl:copy-of

xsl:for-each

xsl:if

xsl:match

xsl:param

xsl:sort

xsl:template

xsl:value-of

xsl:variable

xsl:with-param

 

operatorstop

=
!= 
<
<=
>
>=
|
+
-
*
div
or
and
mod (remainder) 

xpath & functionstop

vehicle/car/@pricebracket

vehicle/car[@pricebracket = type/used/@pricebracket]/make

concat('uni', 'code') returns "unicode"

upper-case("abCd0") returns "ABCD0"

lower-case("ABc!D") returns "abc!d"

contains ( "syntax", "tax") returns true

starts-with("cartoon", "car") returns true

ends-with ( "telephone", "phone") returns true

substring("xpath functions", 7) returns "functions".

substring("metadata", 4, 3) returns "ada".

substring-before ( "hello", "ello") returns "h"

substring-before ( "abcdefghi", "--d-e-", "CollationA") returns "abc"

substring-after("xslt parser", "xslt ") returns "parser"

string-length("XSLT examples.") returns 14

normalize-space(" The  developer got  some new code. ") returns "The developer got some new code."

matches("xpath", "pat") returns true

matches("programming", "^p.*g$") returns true

translate("bar","abc","ABC") returns "BAr"

translate("abcdabc", "abc", "AB") returns "ABdAB"

replace("web developer", "web", "systems") returns "systems developer"

replace("AAAA", "A+", "b") returns " b "

position()

last()

xpath axestop

ancestor
ancestor-or-self
attribute
child
descendant
descendant-or-self
following
following-sibling
namespace
parent 
preceding
preceding-sibling
self

xsl:apply-templatestop

<xsl:apply-templates select="###"/> 

or

<xsl:apply-templates select="###" mode="###"/>

xsl:attributetop

<a><xsl:attribute name="href">http://www.eltreno.com</xsl:attribute>www.eltreno.com</a> 

xsl:call-templatetop

<xsl:call-template name="###"/>

xsl:choosetop

<xsl:choose>
    <xsl:when test="###">
        <xsl:apply-templates select="#"/>
    </xsl:when>
    <xsl:otherwise>
        Try again!
    </xsl:otherwise>
</xsl:choose>

xsl:copy-oftop

<xsl:copy-of select="###"/>

xsl:for-eachtop

<xsl:for-each select="###">

</xsl:for-each>

xsl:iftop

<xsl:if test="###">

</xsl:if>

xsl:matchtop

<xsl:template match="###" mode="###"> 

</xsl:template>

xsl:paramtop

Used with xsl:match or xsl:template

<xsl:template match="###">
    <xsl:param name="###" />
</xsl:template>

xsl:sorttop

used with xsl:apply-templates or xsl:for-each

Attributes
select="some/xpath"
order="ascending | descending" //defalut ascending
case-order="upper-first | lower-first" //defalut ascending
data-type="number | text | qname"
lang="language-code" 


<xsl:apply-templates select="####">
    <xsl:sort select="car/price" data-type="number"  order="descending" />
</xsl:apply-templates>

xsl:templatetop

<xsl:template name="###"> 

</xsl:template>

xsl:value-oftop

<xsl:value-of select="###"/>

xsl:variabletop

<xsl:variable name="###" select="###"/>

<xsl:value-of select="$###"/>

xsl:with-paramtop

Used with xsl:apply-templates or xsl:call-template

<xsl:apply-templates select="###">
    <xsl:with-param name="###">
        <xsl:value-of select="###"/>
    </xsl:with-param>
</xsl:apply-templates>
 
 

Contact: [email protected]