|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] What effect does DOCTYPE have
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








