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] Alternatives to entities for referencing small substitutions


Hi Paul,

Am Dienstag, 18. Oktober 2016, 20:38:00 schrieb Paul Hoadley:
> 
> What is the state of the art for small text substitutions (basically just
> domain-specific terms) that can also be varied via the profiling machinery?
> I have an application that can run as more than one “product”, and each
> product shows domain-specific variations in labels, for example, in the
> user interface. There might be a generic term for some object “Foo”, but
> Application A will call this a “Bar”, and Application B calls it a “Baz”.
> What I want to be able to do is refer to a “Foo” throughout the source, but
> substitute “Bar” for App A’s output, and “Baz” for App B’s. What’s the best
> way to achieve this?

This sounds like profiling in combination with entities.

You could define your foo entity like this:

 <!ENTITY foo  "<phrase><phrase
     os='a'>Bar</phrase><phrase
     os='b'>Baz</phrase></phrase>">

The <phrase> element is quite neutral and is allowed where inline elements are 
also allowed.

When you have this "foo" entity, you can refer to it throughout your document 
as &foo;. Of course, you need to set the profiling attribute os accordingly to 
filter it for application A or B.

We use it for different product names and numbers which applies the same 
approach. It works great.

Keep in mind, this approach relies on a "side effect": it depends on phrase 
being allowed in all contexts. This is not always the case. For example, you 
cannot use &foo; inside attribute values. Or, if you have customized the 
DocBook schema and you don't allow phrase in, let's say, a title. That won't 
work as you will get validation errors.

Apart from this, I think you will be happy with this approach. ;-))

-- 
Gruß/Regards
  Thomas Schraitle



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