#RefreshCache Effective XSLT Making use of XSLT to better customize your data. Daniel Hazelbaker Information Technology Manager High Desert Church
What is XSLT? XSLT is used to transform an XML document into another XML document, or another type of document that is recognized by a browser, like HTML. XSLT uses XPath to reference the elements inside the XML document.
Common Element Functions
Full Element Function List
XSLT/XPath Basics “group” – All node elements whose name is “group” – The “name” attribute of the current node = 1]” – All node elements whose name is “group” and has an attribute called “active” whose value is 1.
XSLT/XPath Basics (cont.) “group/member” – All node elements whose name is “member” and whose parent node name is “group” (that is, all group members). = = ‘Daniel’]” – All small group members whose first name is “Daniel” and is a member of a currently active group. = 1 and ‘Victorville’)]” – All small groups which are active and whose name contains the word “Victorville”
Using ‘if’ statements
Using ‘choose’ statements
Using Parameters no <![CDATA[... ]]>
Looping through a list More Info
Embedding Javascript or CSS <![CDATA[ $(document).ready(function() { alert('Document is ready!'); }); ]]>
Comparison Operators andLogical-and (&&) author[degree and award] orLogical-or (||) author[degree or award] =Equality = ‘yes’ !=Not equal != ‘yes’
Comparison Operators (cont.) <Less than (<) < 20] <=Less than or equal (<=) <= 400] >Greater than (>) > 20] >=Greater than or equal (>=) >= 400]
XPath Functions count() id() last() local-name() name() namespace-uri() position() concat() contains() normalize-space() starts-with() string() string-length() substring() substring-after() substring-before() translate() boolean() false() lang() not() true() ceiling() floor() number() round() sum()
Counting Tiny Small Groups There are small groups with less than 6 members.
Debugging for-each loops Processing element number of...
Cheat Sheets – XPath by DeepX Ltd – XSLT 1.0 Quick Reference by DeepX Ltd