[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: RE: [docbook-apps] Including plain text: CDATA
Hi, You can do this: <xsl:output cdata-section-elements="node"/> where "node" is the name of the node you want to output as CDATA. However, you shouldn't care whether it is output in CDATA sections or not, as <node>foo & bar</node> is the same as <node><![CDATA[foo & bar]]></node> as far as the processor is concerned. Regards, Rob Shields > -----Original Message----- > From: Bob Stayton [mailto:bobs@sco.com] > Sent: 01 December 2003 20:50 > To: Michael Wiedmann > Cc: DocBook-Apps ML > 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 > > 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 _____________________________________________________________________
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]