[xsl] What effect does DOCTYPE have

Subject: [xsl] What effect does DOCTYPE have
From: "Rick Quatro" <frameexpert@xxxxxxxxxxxx>
Date: Tue, 31 Jan 2006 08:03:01 -0500
Hello All,

I have an input document like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE reference SYSTEM "file:///C:/Program%20Files/Adobe/FrameMaker7.2/structure/xml/P_DITA/app/ditabase.dtd" [
<!-- Begin Document Specific Declarations -->
<!-- End Document Specific Declarations -->

<?Fm Condition Comment Red NO_OVERRIDE show?>
<?Fm Condition Prolog PANTONE%20648-50%20CVP NO_OVERRIDE hide?>
<?Fm Condition Internal Black DOUBLE_UNDERLINE show?>
<reference id = "SampleTitle"
   audience = "Publishing Smarter Reviewers Only" rev = "Draft"
   outputclass = "Chapter"
   xmlns:ditaarch = "http://dita.oasis-open.org/architecture/2005/";>
<title>Sample Title</title>
<?Fm Condstart Prolog?>
<?Fm Condend Prolog?>
<p>This is a sample.</p>
<?Fm Condstart Comment?>
<draft-comment author = "Bernard" importance = "normal">
<p>Some comment here</p>
<?Fm Condend Comment?>

I want to produce the exact same output, but with some changes to the processing instructions; I want to change them all to show or hide. When I run this in Saxon 8.5, it takes a long time, and I finally get an out of memory error. Does the XSLT processor try to read the DTD? Is there anyway to avoid this? I essentially want the same output, including the DOCTYPE info, but with changes to the processing instructions. Here is the stylesheet I am using.

<xsl:stylesheet version="1.0"

<xsl:variable name="find" select="hide"/>
<xsl:variable name="replace" select="show"/>

<xsl:template name="do-replace">
 <xsl:param name="text"/>
 <xsl:when test="contains($text, $find)">
   <xsl:value-of select="substring-before($text, $find)"/>
   <xsl:value-of select="$replace"/>
   <xsl:call-template name="do-replace">
     <xsl:with-param name="text" select="substring-after($text, $find)"/>
   <xsl:value-of select="$text"/>

<xsl:template match="*">
   <xsl:copy-of select="@*"/>

<xsl:template match="processing-instruction('Fm')">
 <xsl:processing-instruction name="Fm">
 <xsl:call-template name="do-replace">
   <xsl:with-param name="text" select="."/>

<xsl:template match="processing-instruction()">


Thank you very much.

Rick Quatro
Carmen Publishing

Current Thread