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

What effect does DOCTYPE have

Subject: What effect does DOCTYPE have
From: "Rick Quatro" <frameexpert@xxxxxxxxxxxx>
Date: Tue, 31 Jan 2006 08:03:01 -0500
what does doctype do
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?>
<prolog>
<author>Bernard</author>
</prolog>
<?Fm Condend Prolog?>
<refbody>
<section>
<p>This is a sample.</p>
<?Fm Condstart Comment?>
<draft-comment author = "Bernard" importance = "normal">
<p>Some comment here</p>
</draft-comment>
<?Fm Condend Comment?>
</section>
</refbody>
</reference>

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

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

<xsl:template name="do-replace">
 <xsl:param name="text"/>
 <xsl:choose>
 <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:call-template>
 </xsl:when>
 <xsl:otherwise>
   <xsl:value-of select="$text"/>
 </xsl:otherwise>
 </xsl:choose>
</xsl:template>

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

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

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

</xsl:stylesheet>

Thank you very much.

Rick Quatro
Carmen Publishing
585-659-8267
www.frameexpert.com

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.