Teacher is very picky, document must have all these things
Sean has a new project for you to work on. In addition to digital games, the Harpe Gaming Store also sells board games. Sean is working on a page describing a few sample board games. He has created an XML document named games.xml that contains the description of two games, as well as scores the store has given the games on a 1 to 10 scale in seven categories. Sean also has an XML document named game_reviews.xml containing reviews written up in other gaming websites and an XML document named reviewers.xml that describes those websites.
Sean wants all of this information collected and displayed using a customized style sheet. He would like the style sheet to calculate the average score given to the selected board game and wants all numeric values and dates to be nicely formatted. Figure 6-46 shows a preview of the completed project.
1. Using your editor, open the gamestxt.xml and gamestxt.xsl .Enter your name and the date in the comment section of each ﬁle and save them as games.xml and games.xsl , respectively.
2. Go the games.xml ﬁle in your editor. Take some time to review the contents of the ﬁle and then link the games.xsl style sheet file to the file. Close the games.xml file, saving your changes.
3. View the contents of the game_reviews.xml and reviewers.xml ﬁle in your editor, taking note of the structure and content of each document. Close the files. You do not have to save any changes to these documents.
4. Sean also has created a library of functions you’ll use in this project. Open the hgfunctions.xsl ﬁle in your editor and study the contents. The document has two templates. One template matching the releaseDate element is used to convert date values from the mm/dd/yyyy format to the Month Day, Year format. The second template, named imageRow, is used to create a row of inline images. The imageRow template has two parameters: the imgFile parameter speciﬁes the name of the image ﬁle, and the imgCount parameter speciﬁes the number of images to be displayed. After studying the les, close the document. You don’t have to save any changes.
5. Go to the games.xsl ﬁle in your editor. Directly after the opening tag, use the include element to include the contents of the hgfunctions.xsl style sheet.
6. Directly after the include element, create the following global parameters and variables:
a. The gameID parameter with a default value of ‘bg210’. This parameter will be used to select different board games to display in the web page.
b. The currentGame variable containing the /games/game[@gid=$gameID] node set. This variable will be used to select the game to display in the report.
c. The externalReviews variable containing the /reviews/review[@gid=$gameID] node set from the game_reviews.xml ﬁle. ( Hint : Use the document() function.) This variable will be used to access customer reviews for the current game.
d. The externalReviewers variable containing the /reviewers node set from the reviewers.xml ﬁle. This variable will be used to access the list of reviewers for the report.
7. Go to the root template and make the following style changes so that the report displays information for the current game selected by the user:
a. Go to the
2 – 8
2 – 6
Such a cheap price for your free time and healthy sleep
All online transactions are done using all major Credit Cards or Electronic Check through PayPal. These are safe, secure, and efficient online payment methods.