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] color coding

Orm Finnendahl wrote:

> 1. How should I do the markup the xml? It's no problem to markup the
>    xml in order to identify methodnames, classnames, type specifiers,
>    comments and such with inline tags before processing, but I
>    couldn't find the appropriate tagnames in the Docbook definition.

For the sake of syntax highlighting I would use <phrase role="keyword">, 
<phrase role="literal"> or something like that.

> 2. Is there some description how to change the xsl files in order to
>    generate some appropriate output for html and pdf?

If you mark up your XML source as above you can then very easily 
customize template which is responsible for processing the phrase 
element to output appropriate HTML and FO code. See


> I found pages by Lars Trieloff describing how he managed to get
> Syntaxhighlighting to work with Saxon and jedit, but it seems this
> method is depending on those programs and I'd prefer to do it with
> emacs and xslt (apart from the hassle to program some appropriate java
> code for support of this language). I didn't see the source files of
> his web pages, but I guess, he didn't markup the xml at all and the
> Highlighting was done automatically in Saxon using the jedit plugin for
> identifying the styles to apply.

Yes. This is a big advantage of Lars's solution. It just works on 
unmodified DocBook source, you don't have to preprocess sourcecode 
listing to markup syntax highlighting there.

> Although I could hardly find anything at all concerning DocBook and
> Syntax highlighted output I think there must be a consistent way to
> implement this without customizing the xml parser itself. Or is
> DocBook the wrong way altogether?

No need for change in XML parser. I see two solutions to your problem:

1. Markup syntax highlighting codes explicitly in your source (of course 
this can be automated by some script or using Emacs htmlize function). 
Easy customization of stylesheets is then enough to get desired result.

2. Do the syntax highlighting on-the-fly during processing. In this case 
you must implement grammar (or at least regulat expression based rules) 
for your language directly in the XSLT or as an XSLT extension. This is 
harder to implement (but you can use Lars's implementation 
out-of-the-box) but easier to use IMHO.


   Jirka Kosek  	
   e-mail: jirka@kosek.cz

S/MIME Cryptographic Signature

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