This is the mail archive of the docbook@lists.oasis-open.org mailing list for the DocBook project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Newbie - How to include entities?


Jim Ide <jide@lgb-inc.com> writes:

> [...]
>
> 1. The john, paul, george, and ringo entities are used throughout
> the chap1, chap2, and chap3 files.  I would like to keep the john,
> paul, george, and ringo entities (plus many others) in a separate
> file and include them.  Can I do this?  How?

If they're 'system wide' entities useful in other books, you might
declare them in the dbgenent.mod file (in same directory as the DTD).

Add entity declarations to that, and the entities will automatically
be available in all your DocBook documents. You won't need to set up
separate parameter entity references in your doc instances-- just the
same old DOCTYPE declaration pointing to your local DocBook DTD.

But if you don't have write permissions on dbgenent.mod, that setup
doesn't do you any good. And if these are 'local' entities you're
using only in one book, no point in putting them into dbgenent.mod at
all-- just use what Rune Enggaard suggested.

> 2. I am writing a users manual that will be showing error messages
> like "An error occurred in module ? - please contact the help desk."
> I currently do something like this:
> 
> 	<!ENTITY part1	"An error occurred in module ">
> 	<!ENTITY part2	"please contact the help desk.">
> 
> 	&part1; moduleX &part2;
> 	[...]
> 
> Is it possible to create an entity or macro where I can substitute
> the % (or some other symbol) with a parameter? Maybe something like
> 
> 	&errmsg(moduleX);
>       [...]
>
> to produce the same results?  Is it possible to pass multiple arguments?

As Rune Enggaard point outs, nothing like that available. But maybe a
better anyway to do it in the XSLT/DSSSL stage, using generated text.

You wouldn't have to put the "An error occurred in [module] - please
contact the help desk" anywhere in your doc instances. Instead use the
Role or maybe Condition attribute and do something like the following.
(Don't know your context, so this is just a contrived example).

  The following error message may appear:

  <errorname role="helpdesk">moduleX</errorname>

Then write a stylesheet customization layer with a template to catch
instances of <errorname role="helpdesk">, and wrap the generated text
around them. For help with that, send a note to the docbook-apps list.




------------------------------------------------------------------
To unsubscribe from this elist send a message with the single word
"unsubscribe" in the body to: docbook-request@lists.oasis-open.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]