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] Including plain text: CDATA


On Sat, Nov 22, 2003 at 07:10:40PM +0100, Michael Wiedmann wrote:
> I followed Bob Stayton's advice in "Chapter 19. Modular DocBook files;
> Including plain text" of his "DocBook XSL: The Complete Guide".
> 
> Is there any good solution if the included file contains the "special"
> XML characters (&, <, >, and ")? I don't want these characters to be
> converted to their respective entities, but instead want to wrap them
> in CDATA sections to appear verbatim in the output.

I'm not surprised you didn't get any answers on this one.
I was hoping someone would have a brilliant solution, but
it doesn't look like it.  Basically it is really hard to
get angle brackets as text in your HTML or XML output as
it breaks the processing model.

Your input of angle bracket text, even within CDATA, is
treated internally as text, not elements. If it were treated
as elements, then it would need a matching template to be
output properly.

When an element is processed by XSLT, it generates output
elements in the internal result tree. When done, the
elements in the result tree are then converted to something
with angle brackets by the output serializer.  Any text
is escaped so as to not interfere with the output
element's angle brackets.

There are two exceptions that I can think of:

1.  Only the serializer for text output
using <xsl:output method="text"/> will generate literal angle
brackets from text.  But then you don't have HTML output
at all.

2.  You can get literal angle brackets for HTML or XML
output when your text is contained in:

<xsl:text disable-output-escaping="yes">...</xsl:text>

But this is tricky to do for your input, because
you cannot put a <xsl:value-of> element inside
an <xsl:text> element.

So you might consider treating your incoming angle
bracket stuff as elements, not text, and copying them to
the output using <xsl:copy-of>.  


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]