HTML and CSS Reference
In-Depth Information
1
If necessary,
click line 10.
for-each
element will
loop through
all XML
document
instances
Enter the code
shown in
Table 12-28,
indenting as
shown, to
complete
the XSL
style sheet
(Figure 12-26).
XSL sort element
directs XSL to sort
on item-description
element
<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"?>
Comment:
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.
Example:
<?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