CMT3315  –  Laboratory 15  –  18 February ’11
Friday 4:30 am H104
Quick questions:
- The XSL family of languages can use a stylesheet to transform an XML document into an HTML document, which can be displayed by a web browser, with sophisticated formatting that takes account of the special features of the information in the XML document. Some web programmers, however, prefer to use a CSS stylesheet to look after the formatting of the XML document. Why?
 - Sometimes, you will see an XSL stylesheet whose namespace declaration looks like this:
 
<xsl:stylesheet version=”1.0”
xmlns:xsl=http://www.w3.org/1999/XSL/Transform>
And sometimes you will see an XSL stylesheet whose namespace declaration looks like this:
<xsl:transform version=”1.0”
xmlns:xsl=http://www.w3.org/1999/XSL/Transform>
What difference does this make to the functioning of the stylesheet?
- In XSL, what is the difference between “pull” transformations and “push” transformations?
 
Longer question:
Consider  the following XML document, which is part of a list of staff allocations in a hospital:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="stylingXSL.xsl"?>
<staff-roll xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <post type="surgeon">
  <name>Joe White</name>
  <departmental-jobs>
   <department dept="thoracic">
    <joined>2009</joined>
    <duties>heart surgery</duties>
   </department>
  </departmental-jobs>
 </post>
 <post type="theatre sister">
  <name>R. Kaur</name>
 </post>
 <post type="nurse">
  <name>A. Adeleke</name>
   <departmental-jobs>
    <department dept="thoracic">
     <joined>2010</joined>
      <duties>general ward nursing
      </duties>
    </department>
  </departmental-jobs>
 </post>
<post type="nurse">
 <name>D. Borg
 </name>
  <departmental-jobs>
   <department dept="general surgery">
    <joined>2005</joined>
    <duties>general ward nursing</duties>
   </department>
   <department dept="thoracic">
    <joined>2005</joined>
    <duties>general ward nursing
    </duties>
   </department>
  </departmental-jobs>
 </post>
 <post type="IC specialist">
  <name>E. Said
  </name>
 </post>
</staff-roll>
Clearly, it is intended to use an XSL stylesheet called stylingXSL.xsl. Here is a first attempt at this stylesheet: 
<?xml version="1.0"?>
<!-- File: stylingXSL.xsl -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <HTML>
     <HEAD>
        <TITLE>Staff deployment</TITLE>
      </HEAD>
      <BODY>
        <H1> Staff and their departmental duties </H1>
        <H2>
          Name: <xsl:value-of select="staff-roll/post/name"/>
          <br/>
          Job title: <xsl:value-of select="staff-roll/post/@type"/>
        </H2>
      </BODY>
    </HTML>
   
  |   
</xsl:stylesheet>
   
  |   

nice and really a amazing post
ReplyDeleteRestaurant Bruges
I too prefer using CSS stylesheet for formating, but find this one also good. Thanks for sharing the post.
ReplyDeleteB&B Brugge
Aw someone info!!!!!!
ReplyDeletecss gallery