Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
You can make the display more readable by creating a new XSL file that transforms the heading data in the Sales.xml file into a presentable format.
To transform the heading data
-
Use the Copyand Pastecommands to place the following text into your HTML editor.
Copy Code <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">"""""" <xsl:template match="/"> <HTML> <HEAD> <TITLE><xsl:value-of select="//summary/heading"/></TITLE> </HEAD> <BODY> <h1><xsl:value-of select="//summary/heading"/></h1> <h2><xsl:value-of select="//summary/subhead"/></h2> <p><xsl:value-of select="//summary/description"/></p> </BODY> </HTML> </xsl:template> </xsl:stylesheet>
-
Save the file as Transform.xsl .
-
Open Sales.xmlin your HTML editor and add the following line directly below <?xml version="1.0"?>.
Copy Code <?xml-stylesheet type="text/xsl" href="transform.xsl"?>
This identifies the XSL file to be used for formatting information.
-
Save Sales.xml.
-
To view the file in Internet Explorer, open Sales.xml.
The summary information for your sales report is formatted so it is easy to view.
How It Works
The
xsl:
lines at the beginning and end of Transform.xsl
tell Internet Explorer that this is an XSL file. The XSLT parser
looks for patterns in the XML data as indicated by <xsl:value-of
select=. For example,
select="//summary/heading" directs the parser to look for a
<heading> tag that is contained in a <summary> tag.
When the parser locates this pattern, the tag is formatted as an
HTML <h1> tag.