Sample Solutions for the XSLT Exercises of Lab 3 ================================================ These are possible ways to express the XSLT transformations Lab 3. There are also many equivalent solutions. ------------------------------------------------------------------------------------ 1. Return a list, inside an element , of recipes, containing for every recipe the recipe's title element and an element with the number of calories. Use different approaches: (a) express iteration by recursive calls of templates (b) express iteration by elements. Create new elements (a) by explicit construction, that is by writing the tags into the code, (b) by dynamic construction, that is, by using and elements, (c) by shallow and deep copying, wherever the latter is possible. Approaches: (a) Recursive calls and (a) explicit construction <xsl:value-of select="title"/> Approaches: (a) Recursive calls and (b) dynamic construction Approaches: (b) Iteration with for-each and (c) copying ------------------------------------------------------------------------------------ 2. Using iteration by recursion, return a similar list, alphabetically ordered according to title, <xsl:value-of select="title"/> ------------------------------------------------------------------------------------ 3. Using Iteration by means of , return a similar list, ordered according to calories in descending order. (Hint: Consult the Web, e.g. the website www.w3schools.com, if you encounter difficulties with the ordering.) ------------------------------------------------------------------------------------ 4. Return a similar list, with title as attribute and calories as element content. ----------------------------------------------------------------------------- 5. Return a list, inside an element , of recipes, where each recipe contains the title and the top level ingredients, while dropping the lower level ingredients. <xsl:value-of select="title"/>