[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Scalability problem + solution

Subject: RE: Scalability problem + solution
From: DPawson@xxxxxxxxxxx
Date: Tue, 12 Oct 1999 15:07:44 +0100
stylesheet for p
Example of usage of multiple source and
output files.
Tks to David Carlisle for the advice.

Regards, DaveP

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>

&sect1; <!-- Calls in the section *contents*, sans doctype -->
&sect2;
&sect3;
</doc>

section file - sect (n).xml

<!DOCTYPE doc SYSTEM "doc.dtd"[
<!ENTITY sect1c SYSTEM "sect1c.xml">
]>


&sect1c;     <!-- Similarly, calls in the *contents*, sans doctype -->
<!-- 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 "&#160;"> 
<!ENTITY sp  "<xsl:text> </xsl:text>">

]>
  
<xsl:stylesheet
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      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>

<p>This is from the stylesheet  </p>     <!-- Generated Text -->
  <xsl:for-each select= "//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">
  <xsl:variable name="docnumber">  <!--Generate a number from section posn
-->
    <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


Now I can edit the sections with emacs,
and nsgmls can validate it for me,
and xt can correctly number it for me across
section boundaries.

Delighted!

DaveP


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.