skip to Main Content

WHERE CAN YOU FIND YOUR FAVORATE CAFE?(Maximum Points: 50)While HTML is a markup

WHERE CAN YOU FIND YOUR FAVORATE CAFE?(Maximum Points: 50)While HTML is a markup language with a fixed set of tags that allows users to specifythe appearance of a document, XML (extensible markup language) allows the user tocreate new tags to provide a document structure appropriate to the task at hand. Adocument has three aspects: structure, appearance, and content. In the case of XML,these aspects are separated, with different means employed for defining the structure,the appearance, and the content. Usually, the document type definition (DTD) filedescribes the structure of a document; the appearance is specified by an extensiblestyle sheet (XSL); and the content is provided in the XML document.In the case of XML, the Web server does not send an HTML document but rather sendsthe XML and the XSL documents, and the client must have XML/XSL processors todisplay the document. In this assignment, you will learn to create a simple XMLdocument first. You will then learn to specify the structure of the XML file and formatyour XML document using XSL.A. Creating a Simple XML Document (20 points)As a programmer, you are asked to provide a cafe comparison table for web surfers. Inorder to do that, you first need to create all the related cafe information using a simpleXML document.1. Open Notepad or any XML Editor on your computer system, create a file andname it CAFE.xml.2. First define the XML version by writing “ ” in the first line.3. The next line, “”, refers to thetype of style sheet used and the name of the file.4. The structure of the XML file is simple. At the root is a structure called CAFES.This structure at the next level has a repeated number of child structures calledCAFE. In turn, the structure CAFE has one attribute, CAFE_TYPE, and it hasfive elements:? CAFE_NAME? FOOD_QUALITY? ENVIRON? COST_RATING? COMMENTS5. The code for the entire file CAFE.xml is in the following image:B. Formatting XML Using XSL (20 points)6. Now consider the XSL file, CAFE.xsl. The file accomplishes several tasks: (1) theXSL file generates the HTML code that eventually runs on the browser. TheXSL file has to create the necessary HTML tags for that purpose. (2) As part ofthe above, the XSL code creates a table that has the tabular headings in the firstrow. (3) Looping constructs allowed in XSL are used to read individual elementsof CAFE in the associated XML file and then to output the values in the HTMLtable.7. Preamble. The file begins with a preamble that defines the location of the XSLspecification by the following line: “xmlns:xsl=“”>”. If it is not working, please try thisline: “version=”1.0″>”. And, remember to add “” as the firstline.8. Template Match. The line: instructs the system to matchthe XSL template right from the root stage of the structure described in the XMLfile (i.e., the entire structure of CAFES/CAFE is to be processed as per the XSLfile).9. The HTML tags for the file and for defining the table are achieved by the followingcode:10. The header row of the table is defined by the code:11. The XML file defines the overall structure of CAFES, which consists ofmultiple repeated child structure elements CAFE. The file CAFE.xml has fiveCAFE child structures. XSL provides the necessary language constructs toextract these values and puts them in an HTML format with the appropriateformatting. The “for-each select” looping construct of XSL is used to loopthrough the CAFES structure, and the XSL construct “value-of select” is used tofetch the values of the individual CAFE elements, such as CAFE_NAME andFOOD_QUALITY, and includes them in the table. This “for-each-select” loopingconstruct of XSL acts the same as a WHILE loop in a computer program. Thelooping construct, such as a WHILE loop, is fixed in length, irrespective of howmany CAFE child structures are involved. The looping code is as follows:12. Now you should have keyed in the necessary code to display the comparisontable. The last thing is to close up all the open tags:13. Please remember that XML code is case sensitive. An upper cased letter isnever the same as the lower cased same letter. And the select element nameshould be exactly the same as mentioned in your xml document. Please checkboth documents carefully.14. Double-click on your xml document, and you shall see the following imageon your computer screen:C. Advanced Part (10 points)Please add three records of your own to the xml document and add a table title tothe XSL document using HTML code. Submit both files to the assignment dropboxin time.*********************************************************************


Do you need help working on this assignment? We will write a custom essay on this or any other topic specifically for you.

Back To Top