Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Xslt tutorial
1. A peek into the world of XSLT Author Neenu George
2. “Style is what gives value and currency to thoughts.” Arthur Schopenhauer (1788-1860) German philosopher. “Style is a simple way of saying complicated things” Jean Cocteau (1889-1963) French author and filmmaker. “The proper words in the proper places are the true definition of style.” Jonathan Swift (1667-1745) Irish-born English satirist.
9. What is XSLT? XSL stands for EXtensibleStylesheet Language Language for transforming XML documents A programming language for XML documents A functional language, based on value substitution Augmented with pattern matching And also template substitution to construct output (based on namespaces Uses XML syntax
14. Correct Style Sheet Declaration The root element that declares the document to be an XSL style sheet is <xsl:stylesheet> or <xsl:transform> W3C XSLT Recommendation is: <xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
15. <xsl:template name="myTemplateName"> ...body of template... </xsl:template> set of rules that are called templates A template contains rules to apply when a specified node is matched. Acts as functions in java <xsl:call-template name="myTemplateName"/> XSLT <xsl:template> Element
16. used to extract the value of a selected node. <xsl:value-of> element can be used to extract the value of an XML element and add it to the output stream of the transformation <xsl:value-of select="XPath expression"/> selects the contents of an element and adds it to the output stream XSLT <xsl:value-of> Element
17. element allows you to do looping in XSLT <xsl:for-each> element can be used to select every XML element of a specified node-set <xsl:for-each select="XPath expression"> XSLT <xsl:foreach> Elements
18. XSLT <xsl:sort> Element <xsl:sort> element is used to sort the output. To sort the output, simply add an <xsl:sort> element inside the <xsl:for-each> element in the XSL file: xsl:sort select="author"/>
19. XSLT <xsl:if> Element <xsl:if> element is used to put a conditional test against the content of the XML file test against the content of the XML file, add an <xsl:if> element to the XSL document. <xsl:if test="expression"> <!-- Content: template --></xsl:if>
20. XSLT <xsl:choose> Element The <xsl:choose> element is used in conjunction with <xsl:when> and <xsl:otherwise> to express multiple conditional tests. <xsl:choose> <xsl:when test="expression"> ... some output ... </xsl:when> <xsl:otherwise> ... some output .... </xsl:otherwise></xsl:choose>
39. Strategies for XSLT Try to pick a single style as much as possible May vary by project Mixing may be necessary but can get confusing Be sure you understand (and probably override the default rules) Shorter patterns are better <xsl:value-of> and <xsl:if> may be easier to deal with than a complex path
40. References Key siteshttp://www.w3.org/Style/XSL http://www.mulberrytech.com/xsl/xsl-list http://www.oasis-open.org/cover/xsl.html Interactive XSLT reference http://www.zvon.org/xxl/XSLTreference/Output/ XSLT: 2nd Edition Programmer’s Reference Michael Kay [Good reference; clear, but not really a tutorial] XSLT & XPath On the EdgeTennison [And her other books]