1) Open up the [login to view URL] file in your text editor. Closely examine the DTD. Review the lecture where we discussed DTDs.
TASK 2: Use the DTD to draw out the XML tree structure for the file. Create the XML tree structure using MS Word or Google Docs, etc. Don’t draw it out by hand.
2) Use XML tree structure to make correct XPath statements in XSLT stylesheets.
TASK 3: With the tree structure, create an XSLT stylesheet for [login to view URL] that will create a table with the following column labels:
Volume, Number, Title, Start Page, End Page, Page Length.
-Choose good value of "select" for-each select statement. Most of the columns in the table represent children of element “article”. Therefore element “article” might be one good suggestion. However, you can’t just enter select="article" with no further thought. This statement would imply that article is a child element of SigmodRecord. Instead, use a correct XPath from your template match (SigmodRecord) to the node you want to select in your for-each statement (article). Determine that XPath and place its value in the select field of the for-each statement.
-The value-of select statements for title, initPage and endPage should be easy.
-We will need to think a little harder about the value-of select statements for volume and number. Why? Is there any direct path between these elements and the element “article”? We typically use XPath to navigate DOWN an XML tree, but it is also possible to use it to navigate back UP. The XPath expression .. will move you one level back up the tree. The XPath expression ../.. will move you two levels back up the tree. What node is two levels back up the tree from “article”? How would you complete this XPath expression to get it to point to element “volume”? Element “number”? Place the correct XPath expressions in the select fields of the value-of select statements for volume and number.
-Now let’s turn to column Page Length. There is no data for that, but we do have the data necessary to calculate it. What should the formula for page length be? Basic math can be done in XPath as follows: However you formulate things, make sure that an article that starts and finishes on page 5 gets counted as being 1 page long rather than 0 pages. Note: obviously you will need to replace nodeX and nodeY with real elements from sigmod.xml.
-Finally, save [login to view URL] and put a reference to it in [login to view URL] after the DTD code. 3
-Open up [login to view URL] (not [login to view URL]!) in Firefox and you should see your new, working table. If not, fix the errors in your .xsl file.