presentation: XSLT Assessment Questions image-directory: cocoon-images Author: Aidan Killian, Martin Dransfield, Warrell Harries For: Wiley Interscience/SCS Date: August 2007 Assessment of XSLT Knowledge slide: XSLT Variables Variable 1 code: Variable 2 code: subtitle: 1.1 What is the difference between Variable 1 & 2 above? Variable 1 holds a result tree fragment with a root node and a text node with string value the decimal representation of a number Variable 2 holds a number 2 points subtitle: 1.2 Why would you use one rather than the other? Variable 2 is simpler and much easier to use in XSLT 1.0 1 points subtitle: 1.3 What is special about XSLT Variables? Variable are assigned once and cannot have their value changed 2 points subtitle: 1.4 Why is this behaviour thought to be desirable? Transparency - it is far easier to reason about a program that is free from side effects. So you can prove your program is correct with less effort. Scalability - pure (side-effect free) programs are much easier to parallelize Debugging - no need to monitor when a variable changes value. 3 Points code: 1 2 4 5 3 10 2 1 subtitle: 1.3 Please declare and initialise a variable that can be used to total the cost of things. 4 points slide: XSLT Features subtitle: 2.1 Please summarise the difference between 'Push' and 'Pull' usage in XSLT? A 'Pull' implementation prefers the use of over the use of 2 points subtitle: 2.2 Please describe four differences between XSLT v1.0 and v2.0? New options for the grouping of nodes: the xsl:for-each-group instruction and the current-group() function have been added. Users can create and use custom functions in the stylesheet The possibility of generating multiple output documents have been extended in comparison to XSLT 1.1. You can also link between these 'result trees'. XHTML output method has been added. There is a new xsl:sort-key declaration. The possibility to create a temporary tree on which to perform actions. A new instruction xsl:namespace has been added to generate namespace nodes. 4 points slide: Template Usage code: subtitle: 3.1 In the template above name the computing technique being used? Recursion 1 points subtitle: 3.2 Please give one benefit and one disadvantage of this technique Benefit Generates new variables on each iteration Disadvantage Resource hungry 2 points code: subtitle: 3.2 In the XSL 1.0 template above describe the purpose of xalan:nodeset? It's a XalanJ extension function that allows processing of result tree fragments in XSLT 1.0 subtitle: 3.3 Why is the following stylesheet often used by XSL developers? code: ______________________________________________________________________________________ ______________________________________________________________________________________ ______________________________________________________________________________________ ______________________________________________________________________________________ ______________________________________________________________________________________ slide: XPath subtitle: 4.1 When might you use current() rather than '.' when selecting a node? ______________________________________________________________________________________ ______________________________________________________________________________________ ______________________________________________________________________________________ ______________________________________________________________________________________ img_fullWidth: xmlTree.jpg subtitle: 4.2 Please write an XPath expression that returns the contents of all p elements that follow the one with ID="p13" ______________________________________________________________________________________ ______________________________________________________________________________________ ______________________________________________________________________________________ ______________________________________________________________________________________ ______________________________________________________________________________________ ______________________________________________________________________________________ ______________________________________________________________________________________