Starting from:

$30

CSCI128-Lab 8 Solved

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:\Users\jsmith\Desktop\my web" 

 

python -m http.server 8000 -d "C:\Users\jsmith\Desktop\my 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 

        <titleXSLT 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" 

  <contestantId00025142</contestantId 

  <examIdKB253DG</examId 

  <score156</score 

  <bandC</band 

  <digitalSignaturea720cf8e23bc1256bce2</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" 

    <codeMATH101</code 

    <titleCalculus</title 

    <statistics 

      <enrol170</enrol 

      <withdrawn31</withdrawn 

    </statistics 

  </subject 

 

  <subject sid="1734231" 

    <codeMATH234</code 

    <titleAbstract Algebra</title 

    <statistics 

      <enrol40</enrol 

      <withdrawn15</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:​       

  

More products