[Previous] [Contents]


Exercises


1. You have seen how you can use select to capture a specific element. Given the following fragment of XML code, write the XSL template to reverse the order and output the string (use a sequence formatting object) "cccbbbaaa":
           <list>
         <itema>aaa</itema>
         <itemb>bbb</itemb>
         <itemc>ccc</itemc>
           </list>
2. Using the same XML fragment used for the previous exercise, write the XSL template to skip the itemb element and output the string "aaaccc".
3. Given the following XML file, write an XSL style sheet to convert it into an HTML document:
         <?xml version="1.0"?>
         <!DOCTYPE page [
          <!ELEMENT page (#PCDATA, page)*>
          <!ELEMENT para (#PCDATA, image)*>
          <!ELEMENT image (#PCDATA)>
         ]>
         <page>
        <title>My Home Page</title>
        <para>This is my first basic home page
created in XML.</para>
        <para>It even includes an image:
<image>logo.gif</image>.</para>

      </page>



[Previous] [Contents]