Initial Setup: Create a directory to store the code of this lab exercise. Follow the instructions below to start a web server at the newly created directory.
Running web server on Mac using command:
python3 -m http.server [port-number] -d [web-directory]
For example, to run on port 50000 and directory /Users/jsmith/Desktop/myweb
python3 -m http.server 50000 -d /Users/jsmith/Desktop/myweb
The website will be at the address: http://localhost:50000/
Running web server on Windows using command:
python -m http.server [port-number] -d [web-directory]
For example, to run on port 8000 and directory C:UsersjsmithDesktopmy web
python -m http.server 8000 -d C:UsersjsmithDesktopmy web
The website will be at the address: http://localhost:8000/
Here is a sample of XML code with stylesheet:
<?xml version=1.0 ?>
<?xml-stylesheet type=text/xsl href=FILE-NAME-HERE.xsl?> XML code here
Here is a sample of XSLT code:
<?xml version=1.0 ?> <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform xmlns=http://www.w3.org/1999/xhtml> <xsl:output method=xml indent=yes encoding=UTF-8/> <xsl:template match=/PUT-THE-ROOT-ELEMENT-HERE> <html><head><title>XSLT example</title></head> <body>HELLO WORLD</body></html> </xsl:template></xsl:stylesheet> |
Question 1. Given the following XML code containing an exam result:
<?xml version=1.0?>
<result ref=10007629P>
<contestantId>00025142</contestantId>
<examId>KB253DG</examId>
<score>156</score>
<band>C</band>
<digitalSignature>a720cf8e23bc1256bce2</digitalSignature> </result>
Write the XML code into the file question1.xml and use the stylesheet question1.xsl to produce the following output:
Question 2. Similar to question 1, write the XML code into the file question2.xml and use the stylesheet question2.xsl to produce the following output:
Question 3. Given the following XML code containing subject enrolment statistics:
<?xml version=1.0?>
<audit campus=Woolloomooloo year=2000 session=A>
<subject sid=0769642>
<code>MATH101</code>
<title>Calculus</title>
<statistics>
<enrol>170</enrol>
<withdrawn>31</withdrawn>
</statistics>
</subject>
<subject sid=1734231>
<code>MATH234</code>
<title>Abstract Algebra</title>
<statistics>
<enrol>40</enrol>
<withdrawn>15</withdrawn>
</statistics>
</subject>
</audit>
Write the XML code into the file question3.xml and add a few more subject data. Use the stylesheet question3.xsl to produce the following output:
Reviews
There are no reviews yet.