lout-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Formatting DocBookXML with Lout / Latin-1 and Latin-2


From: Michael Piotrowski
Subject: Re: Formatting DocBookXML with Lout / Latin-1 and Latin-2
Date: Fri, 18 Apr 2008 13:50:20 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) XEmacs/21.4.21 (berkeley-unix)

On 2008-04-18, Yves Forkl <address@hidden> wrote:

> that is fine for the "Base" face, but getting italics is a bit more
> tricky as soon as you are generating Lout code from XML rather than
> keying it in. Say I have the above Polish city name in an emphasis
> element like this:
>
> <para><emphasis>The city of &#x0141;&#xf3;d&#x017A; is in
> Poland.</emphasis></para>
>
> By just replacing the special characters as shown above this would
> leave me with something like
>
> @PP address@hidden {The city of { TimesCE Base } @Font { address@hidden 
> address@hidden
> address@hidden zacute} } is in Poland.} }
>
> which of course does not work, the correct code being, I suppose,
>
> @PP address@hidden {The city of} { TimesCE Slope } @Font { address@hidden 
> address@hidden
> address@hidden zacute} } @I {is in Poland.} }

Yes. Unfortunately you can't change the font and keep the style in Lout.

> Generating this Lout code from the above XML sample, however, requires
> analyzing the contents of each text node and conditionally
> transforming its substrings, to split up the @I object as needed. That
> is very hard to do, especially in XSLT 1. Even with the
> string-matching functionality of XSLT 2 it would be quite a lot of
> work.

And that is *precisely* why I would do things like this in Perl [1],
where it's trivial.

> If all of the Latin-2 words were wrapped into an element of their own
> (a preprocessor could be used to do this kind of post-tagging), this
> would at least simplify the transformation, as it would allow to focus
> on that element (and its neighbouring text nodes).
>
> Some ideas on this problem?

Well, either do it in Perl, i.e., iterate over all the text nodes, and
if a word contains Latin 2 characters, insert the appropriate Lout
markup.  Or only mark the words and transform the markup to Lout in the
stylesheet.

Greetings


Footnotes: 
[1]  My approach is to use the XML::LibXML and XML::LibXSLT Perl
     modules, which enables you to access and to manipulate the DOM tree
     from Perl, and to then apply a stylesheet to it.

-- 
Michael Piotrowski, M.A.                               <address@hidden>
Public key at <http://www.dynalabs.de/mxp/pubkey.txt> (ID 0x1614A044)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]