forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikael Sitruk" <>
Subject RE: Question: adding formatting for 'xml' conent of source element
Date Sun, 08 Jun 2003 05:17:32 GMT
Jeff hi

The formatting/colorizing is not problem since I have already done the
color and I have also added the type attribute on the source element.
The real problem is that the source element in the DTD does NOT allow
any element in it. So each time I put XML elements there I get
validation error.

For example:
<source type="xml" xmlns:xsi="">
<field xsi:type="transformation-data-object-field-t" name="Reason
Headline" type="string" visible="true" description="set the backout
reason as headling">
      <extension-function xsi:type="title-case-t" name="title-case"
            <value-ref xsi:type="data-object-field-reference-t"
data-object-id="Backout_Reason" field-name="Reason Desc"/>

Will not pass the validation since the elements: fields,
source-function, operand, extension-function,
built-in-function-parameter are not defined in the DTD.
Since the xml fragments are very heterogeneous and not comes from the
same schema I can't update the DTD each time I want to add an XML
Since the sample source is XML I think that the easiest way is to use
XSL to do the formatting, that's true that for other language chaperon
may be the best fit, but for the current problem I think that XSL is
enough. The only problem still remain to pass the XML validation....
Anyway I will also check your suggestion...


-----Original Message-----
From: Jeff Turner [] 
Sent: Sunday, June 08, 2003 06:04
Subject: Re: Question: adding formatting for 'xml' conent of source

On Sat, Jun 07, 2003 at 03:29:09AM +0200, Mikael Sitruk wrote:
> Hi
> In the document v1.1 DTD there is the 'source' element that permit to
> include "sources" sample in the generated document. 
> I would like to use this tag, to add XML content and to FORMAT it with
> syntax coloring. 
> I've updated the document2xhtml.xsl for formatting XML elements under
> the source element, the XSL works fine, but in order to permit XML
> content under the 'source' element I have to DISABLE the validation of
> the document 1.1 DTD, since the DTD doesn't have the definitions for
> new XML elements in the source element.
> Note: overriding the DTD for each xml fragment that I want to add,
> doesn't seems to be realistic.
> If I put the CDATA declaration, I do pass the validation but the
> coloring is not working. 
> Do someone have an idea how I can include this XML content, and still
> able to format it??

Colourizing <source> contents is somewhere on the "cool features to add"
list.  We want to be able to colourize anything, not just XML, so
need to be a 'type' attribute:

<source type="Java">
  public static void main(String args[]) {
      System.out.println("Hello world");

<source type="XML">

I think the best way to implement this is to use the Chaperon parser to
translate the <source> contents to HTML.  The Cocoon samples have a demo
of colourizing Java code, and Forrest already includes Chaperon for the
Wiki parsing, so everything that's needed (except grammars) should be


> Thanks
> Mikael.S

View raw message