This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
RE: [docbook-apps] Including plain text: CDATA
- From: "Robert Shields" <rshields at star dot net dot uk>
- To: "Bob Stayton" <bobs at sco dot com>,"Michael Wiedmann" <michael dot wiedmann at detewe dot de>
- Cc: "DocBook-Apps ML" <docbook-apps at lists dot oasis-open dot org>
- Date: Tue, 2 Dec 2003 10:17:02 -0000
- Subject: RE: [docbook-apps] Including plain text: CDATA
Hi,
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.
Assuming the output method is xml, not text:
This is not attractive, but it works, if I understand the problem
correctly:
<xsl:variable
name="OpenCDATASection"><![CDATA[<![]]><![CDATA[CDATA[]]></xsl:variable>
<xsl:variable
name="CloseCDATASection"><![CDATA[]]]]><![CDATA[>]]></xsl:variable>
<xsl:value-of select="$OpenCDATASection" disable-output-escaping="yes"/>
<xsl:value-of select="node" disable-output-escaping="yes"/>
<xsl:value-of select="$CloseCDATASection"
disable-output-escaping="yes"/>
Is that a viable solution?
Regards,
Rob Shields
> -----Original Message-----
> From: Bob Stayton [mailto:bobs@sco.com]
> Sent: 02 December 2003 09:05
> To: Michael Wiedmann
> Cc: DocBook-Apps ML
> Subject: Re: [docbook-apps] Including plain text: CDATA
>
>
> On Tue, Dec 02, 2003 at 09:53:57AM +0100, Michael Wiedmann wrote:
> > Bob Stayton wrote:
> >
> > > 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.
> >
> > Is your explanation valid for output method "text" too
> (which is what
> > I have)?
>
> Huh? I missed the part where you said you
> were using the "text" output method. If that
> is the case, then you shouldn't have a
> problem. The rendering of < to text output
> is simply < as you want. If you aren't getting
> that, then something is wrong with your processor.
>
> > > 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.
> >
> > Would it be possible to get the contents of the file in a variable
> > with <xsl:copy-of> (or similar) and the use this variable in
> > <xsl:text>...</xsl:text> ?
>
> That's what I was trying to say. "Use a variable" means
> using <xsl:value-of select="$variable"/>, which is not
> allowed inside xsl:text.
>
> --
>
> 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
>
> To unsubscribe from this list, send a post to
> docbook-apps-unsubscribe@lists.oasis-open.org, or visit
http://www.oasis-open.org/mlmanage/.
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
_____________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
_____________________________________________________________________
To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.