[odf-discuss] Opportunity to move from (adapted) DocBook
to OpenDocument
Daniel Carrera
daniel.carrera at zmsl.com
Tue Jul 31 04:16:41 EDT 2007
Frederic Peters wrote:
> Hello all, first message on this list, it is quite technical compared to
> the recent messages, but I didn't find a better place to ask, feel free to
> redirect me to the right mailing list if it exists.
Here's fine. The list is too quiet anyways :-)
> I am currently studying the conversion of a large corpus of documents
> currently written in a slightly edited DocBook format (with some field
> specific semantics added) to OpenDocument... I am sorry I can't tell
> more at the moment.
Examples would help. For example, are those new tags always inside
paragraphs? Do they have a lot of complex attributes or is it just tags?
> I may do somethinglike this but don't like it much:
>
> <text:p>
> So I called <text:user-field-get text:name="Actor_1">Fred
> </text:user-field-get> but he didn't answer.
> </text:p>
>
>
> This is after I tried to to it with a custom namespace, like this:
>
> <text:p>
> So I called <my:actor ref="1">Fred</my:actor> but he didn't
> answer.
> </text:p>
>
> which was nice but didn't display the name in OOo.
>
> So, going past my local problem, are there guide lines, best practices,
> about extending ODF for specific domains, while remaining compatible with
> both the specification and the applications and tools ?
Well... in theory the right way to extend ODF is to create a new
namespace as you did in your second example (btw, you forgot the
namespace in 'ref'). But then ODF applications won't know about your
namespace and you can expect them to ignore it.
I don't think there are best practices yet, but I have a couple of
ideas. You could use a <text:span> element and add attributes in your
own namespace, like this:
<text:p>
So I called <text:span my:type="actor" my:ref="1">Fred</my:actor> but
he didn't answer.
</text:p>
Now OOo will read it correctly. But if you save with OOo the new
attributes won't survive the round-trip. Another option which is even
more of an ugly hack is to use styles:
<text:p>
So I called <text:span text:style-name="actor"
my:ref="1">Fred</my:actor> but he didn't answer.
</text:p>
But that's really ugly.
Anyone else have any ideas?
Cheers,
Daniel.
More information about the odf-discuss
mailing list