RE: XSLT and Text Processing Languages

Subject: RE: XSLT and Text Processing Languages
From: Matthew Bentley <Matthew.bentley@xxxxxxxxxxxxxx>
Date: Thu, 7 Sep 2000 12:03:32 +1200
>2) XSLT does not allow you to output anything to the document prolog
>aside from the doctype statement, and our XML processes expect entity
>declarations for the graphics to be defined there. 

I am using XSLT for just that very purpose - and I test the starting element
to find out which doctype I want to insert - all you have to do is output
CDATA:

<!-- MATCH ROOT NODE, GENERATE DOCTYPE BASED ON STARTING ELEMENT: -->
<xsl:template match="/">
	<xsl:choose>
		<xsl:when test="bva.grp">
			<xsl:text
disable-output-escaping="yes"><![CDATA[<!DOCTYPE VALUE-ADD.GROUP PUBLIC
"-//Brooker's//DTD Brooker's Legislation Value-Add Group//EN">]]></xsl:text>
		</xsl:when>	
		<xsl:when test="act">
			<xsl:text
disable-output-escaping="yes"><![CDATA[<!DOCTYPE ACT PUBLIC
"-//Brooker's//DTD Brooker's Act//EN">]]></xsl:text>
		</xsl:when>	
		... etc

	</xsl:choose>
	<xsl:apply-templates />
</xsl:template>

And obviously you can put entity references inside the CDATA section as
well, although in this particular case I haven't needed to.

Matt

P.S. XSLT can be fast - in my experience the main factor slowing down
performance is the amount of memory needed to process a large document,
which means that heaps of memory gets swapped to the hard drive on a modern
OS (E.g. on a 79MB XML file I was processing, Saxon made the win95 swap file
grow by 350MB). Theoretically then, if you were able to provide a machine
with an extensive amount of ram (say, 512MB), you could probably process the
document reasonably fast.
******************************************************************
Warning: This email, including any attachments, 
is for the use of the intended recipient(s) only.
Republication and redissemination, 
including posting to news groups or web pages, 
is strictly prohibited without the express prior consent of Brooker's Limited.
******************************************************************


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


Current Thread