| DaveP
Tks to David Carlisle for the advice.
DTD - doc.dtd
<!ELEMENT doc (section)+>
<!ELEMENT section (p)+>
<!ELEMENT p (#PCDATA)>
Root file - doc.xml
<!DOCTYPE doc SYSTEM "/sgml/mine/doc.dtd"[
<!ENTITY sect1 SYSTEM "sect1c.xml">
<!ENTITY sect2 SYSTEM "sect2c.xml">
<!ENTITY sect3 SYSTEM "sect3c.xml">
<!ENTITY dtd "IGNORE">
]>
<doc>
<!-- Calls in the section *contents*, sans doctype -->
§1;
§2;
§3;
</doc>
section file - sect (n).xml
<!DOCTYPE doc SYSTEM "doc.dtd"[
<!ENTITY sect1c SYSTEM "sect1c.xml">
]>
<!-- Similarly, calls in the *contents*, sans doctype -->
§1c;
<!-- Above is duplicated for n other files -->
Section 1 contents file sect1c.xml
<section>
<p>Para in section 1</p>
</section>
Stylesheet
<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
<!ENTITY sp "<xsl:text> </xsl:text>">
]>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Tranform" version="1.0"
xmlns:xt="http://www.jclark.com/xt"
extension-element-prefixes="xt"
version="1.0">
<xsl:output type="html"/> <!-- Main file -->
<xsl:template match="/"> <!-- Only template -->
<html> <!-- Main file output -->
<head>
</head>
<body>
<!-- Generated Text -->
<p>This is from the stylesheet </p>
<xsl:for-each select= "file://p">
<!-- Access all files from the root file -->
<p> <xsl:value-of select="."/> (Accessed from root) </p>
</xsl:for-each>
</body>
</html>
<!-- Now generate one file per section -->
<xsl:for-each select="/doc/section">
<!--Generate a number from section posn
<xsl:variable name="docnumber">
- -->
<xsl:number value="position()"
format="1"/>
</xsl:variable>
<!-- Append the number to the filename -->
<xt:document method="html" href="sect{$docnumber}.html">
<html>
<head>
</head>
<body>
<!-- Output into the section files -->
<p><xsl:value-of select="p"/> </p>
</body>
</html>
</xt:document> <!-- End of sectional output -->
</xsl:for-each> <!-- End of each section -->
</xsl:template> <!-- End of template -->
</xsl:stylesheet> <!--End of stylesheet -->
Output (main file)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
</head>
<body>
<p>This is from the stylesheet </p>
<p>Para in section 1 (Accessed from root) </p>
<p>Para in section 2 (Accessed from root) </p>
<p>Para in section 3 (Accessed from root) </p>
</body>
</html>
Output (sect1.html)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
</head>
<body>
<p>Para in section 1</p>
</body>
</html>
Ditto for other output files, sect (n).html
|