[Po4a-devel]Nested blocks with Xml.pm

Jordi Vilalta jvprat@wanadoo.es
Sat, 4 Dec 2004 09:45:18 +0100 (CET)


Hi,

sorry for the delay in my answer, I've been so busy :(

On Tue, 30 Nov 2004, Yves Rutschle wrote:
> Is there an example somewhere of how one would go at
> processing nested blocks with Xml.pm? As it is, having
> defined the 'block' tags and 'inline' tags, it would produce
> only one msgid for, e.g.:
>
> <div>
>  <h1>blah blah</h1>
>  <p>This is a paragraph</p>
> </div>
>
> because <div> created a block and Xml.pm doesn't descend
> into blocks (as I understand it -- I may be confused).

I don't know if I understand you well. I understand that you have defined 
<div>, <h1> and <p> as translatable.

IIRC, the nested blocks are handled depending on the inline status of the 
inner tag. For example, if you define <p> and <h1> as an inline tag, it's 
normal that they're taken as part of the outer tag. If you define them as 
not inline, they should be splitted as new msgids.

I've tried it with this command line (with sample.html being the fragment 
you gave as an example):

po4a-gettextize -f xml -m ../sample.html -o strip -o tagsonly -o tags="<div> <h1> <p>"

and it generates the following entries in the po file (which I think is 
what you expected):

# type: Content of: <div><h1>
#: ../sample.html:2
#, no-wrap
msgid "blah blah"
msgstr ""

# type: Content of: <div><p>
#: ../sample.html:3
#, no-wrap
msgid "This is a paragraph"
msgstr ""

I hope it helps you. It makes some time that I don't touch the Xml module 
and I don't remember some of its details.

Regards,

Jordi Vilalta