HTML and CSS Reference
In-Depth Information
If necessary,
click line 10.
element will
loop through
all XML
Enter the code
shown in
Table 12-28,
indenting as
shown, to
the XSL
style sheet
(Figure 12-26).
XSL sort element
directs XSL to sort
on item-description
<xsl:text> tags
allow free-form
text to be inserted
paragraph tag
places each product
on a new line
<span> tags with
inline styles format
text or data
Save the XSL style
sheet file.
closing tags
Figure 12-26
Linking an XSL Style Sheet to an XML Document
With the XSL file saved, the next step is to link the XSL style sheet to the XML
document. For this part of the project, you will link the chapter12-1products_solution.xsl
style sheet to the chapter12-1products_solution.xml file that you previously saved from
the Data Files for Students. Linking an XSL style sheet to an XML document requires
an xml-stylesheet processing instruction. Table 12-29 shows the general form of this
xml-stylesheet processing instruction.
Table 12-29 General Form of the xml-stylesheet Processing Instruction
General form:
<?xml-stylesheet type="text/xsl" href="ile path"?>
The processing instruction used to link an XSL style sheet contains the xml-stylesheet type
attribute. The value, text/xsl, indicates that this is an XSL file. The href attribute indicates the
external path or URI of the XSL file.
<?xml-stylesheet type="text/xsl" href="chapter12-1products_solution.xsl"?>
XSL style sheet processing instructions are usually entered in the prolog of the
XML document.
Search WWH ::

Custom Search