Tutorial: Programming with xsl
Zoo tutorials: [ SQL | Java | Linux | XML ]

A Gentle Introduction to xml

Programming with xsl

Question 1: Parameters and call-template.

Here we call with parameter s. At each to rev we either
  • return the string s unchanged (if it has no spaces)
  • output the word then recurse with everything but the first word
  1. Note the <text> element. Change this so that - is used in place of a space.

XML


XSL


Question 2: map string-length.

  1. Change the code so that it returns the length of each word. we should get the string 4 2 1 6 2 4 returned. You may use the function string-length.

XML


XSL


Question 3: So that's why it's called rev!

  1. Reverse the order of the three nodes
    • xsl:call-template
    • xsl:text
    • xsl:value-of
    This should cause the string to be returned reversed.

XML


XSL