Step 5: Adding Other Documents (Windows Embedded CE 6.0)
1/6/2010
Not all documents are sales figures. You can incorporate new XML into your output from external documents through the document() function. This function can take as an argument the relative or absolute Uniform Resource Locater (URL) of the document you want to retrieve as a string or a node in which the text value of that node resolves to a URL. With document(), you load the entire contents of the document, and can even manipulate them as if the document was itself an XML document using XML Path Language (XPath) and XSLT expressions.
You will create a document called Ancillary.xml that will contain a watermark and a copyright notice for the report.
To create Ancillary.xml
Paste the following text into your HTML editor.
<document> <watermark></watermark> <copyright></copyright> </document>
Save the file as Ancillary.xml.
To add the watermark and copyright text to Ancillary.xml
Open Ancillary.xml.
Paste Lucerne Publishing between the <watermark> and </watermark> tags.
Paste the following copyright information between the <copyright> and </copyright> tags.
The file should look like this:
<document> <watermark>Lucerne Publishing</watermark> <copyright>Copyright 2000, Lucerne Publishing. All Rights Reserved.</copyright> </document>
Save Ancillary.xml, and then open Transform.xsl.
To load the ancillary document into the variable named
ancillary
in Transform.xsl, paste the following after the <body> element.<xsl:variable name="ancillary" select="document('ancillary.xml')"/>
To add the watermark, paste the following directly below the lines that you just added.
<div style="position:absolute;font-size:96;font-family:Times New Roman;color:#F0F0F0;z-index:-1"> <xsl:value-of select="$ancillary//watermark"/> </div>
To add the copyright notice, paste the following directly above the </BODY> tag.
<div style="font-size:9"> <xsl:value-of select="$ancillary//copyright"/> </div>
Save Transform.xsl.
Your final result should look like this:
See Also
Tasks
Tutorial: Getting Started with XSLT
Step 4: Adding Conditional Statements