274 11 The XML Transformation Language
The first strategy can be accomplished by using the notion of an XML en-
tity as discussed in section 1.4. A separate “main” file is created that looks
like this:
<?xml version="1.0"?>
<!DOCTYPE ExperimentSet SYSTEM "experiment.dtd"
[
<!ENTITY experiment1 SYSTEM "experiment1.xml">
<!ENTITY experiment2 SYSTEM "experiment2.xml">
<!ENTITY experiment3 SYSTEM "experiment3.xml">
<!ENTITY experiment4 SYSTEM "experiment4.xml">
<!ENTITY experiment5 SYSTEM "experiment5.xml">
]>
<ExperimentSet>
&experiment1;
&experiment2;
&experiment3;
&experiment4;
&experiment5;
</ExperimentSet>
The five files will automatically be incorporated into the main file. This is
done by the XML processor, not by XSLT, and there is nothing in the XSLT
transformation program that mentions anything about these files. Note that
only the main file mentions theDOCTYPE. This strategy requires that the files
being combined form an XML document that conforms to the overall DTD.
To accomplish the second strategy use thedocumentfunction. For exam-
ple,
<xsl:for-each select="document(’experiment1.xml’)">
<xsl:apply-templates/>
<xsl:for-each>
<xsl:for-each select="document(’experiment2.xml’)">
<xsl:apply-templates/>
<xsl:for-each>
will process theexperiment1.xmlandexperiment2.xmldocuments.
Unlike the first strategy, the second strategy processes each document inde-
pendently. So they could have different DTDs.