OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Can I make a XSLT not resolve CDATA sections for programlisting?


On Mon, Aug 25, 2003 at 11:55:39AM -0400, Taro Ikai wrote:
> In my documents I have snippets like:
> 
>   <programlisting>
>   <![CDATA[int foo = 0;
>   foo++;
>   ]]>
> 
> I want to keep this after running it through XSLT. xsltproc resolves it, 
> so I lose the 
> beginning and end markers of the CDATA section. 
> 
> This is very similar to the problem I had trying to keep entity references 
> from being resolved,
> which Bob Stayton helped me with a while ago.
> 
> Can I keep these CDATA sections in the XSLT output? Or is it impossible?
> 
> I know I can use external code files as illustrated at:
> 
> http://www.sagehill.net/docbookxsl/ProgramListings.html
> 
> but I'd like to keep the code listings in place if possible.

In general, an XSLT processor does not preserve
CDATA section markup.  There is one escape feature, though.
Your only hope is to include this in a customization layer:

<xsl:output cdata-section-elements="programlisting"/>

And change the processing of programlisting to
just copy out the programlisting element:

<xsl:template match="programlisting">
    <xsl:copy-of select="."/>
</xsl:template>

The problem is that it will put *all* programlisting
elements into CDATA sections, even if the original did
not use it.  It should still work and produce
the results you expect, but it will be different
from the input.

-- 

Bob Stayton                                 400 Encinal Street
Publications Architect                      Santa Cruz, CA  95060
Technical Publications                      voice: (831) 427-7796
The SCO Group                               fax:   (831) 429-1887
                                            email: bobs@sco.com


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]