This is the mail archive of the
docbook@lists.oasis-open.org
mailing list for the DocBook project.
Re: [docbook] Macros / Entities with custom parameters?
- From: Bob Stayton <bobs at sco dot com>
- To: Antoine Calando <antoine at alliancemca dot net>
- Cc: docbook at lists dot oasis-open dot org
- Date: Thu, 11 Sep 2003 20:10:45 -0700
- Subject: Re: [docbook] Macros / Entities with custom parameters?
- References: <3F57025E.1010804@alliancemca.net>
On Thu, Sep 04, 2003 at 11:14:06AM +0200, Antoine Calando wrote:
> Hi,
>
> I'm trying to find how to write some kind of macro or entity with custom parameters
> that are reused when the entity is expanded. I am not sure it is very clear, so
> here is an example :
>
> I want something like "&dbtag($$$$$);"
> (where dbtag is the entity name, and $$$$$ is a parameter like "section" for instance)
> to be expanded in :
> <ulink url="url_to_docbook_doc/$$$$$"> <sgmltag>$$$$$</sgmltag></ulink>
>
> I search in the DocBook and XML docs but I cannot find anything. May be with SGML?
>
> The better workaround I found would be to do (if $$$$$ is used 2 times):
> "¯o_beginning; $$$$$$$ ¯o_middle; $$$$$$$ ¯o_end;"
> but this not very elegant...
> An other way would be to add a new tag in the dtd and also new xslt rules to handle
> it but that's too much work!
>
>
> If anyone could at least confirm that it's not possible...
Well, there is no such syntax or functionality
associated with entities. They are pretty much
simple substitution. They don't take dynamic
values like a function.
But you could accomplish something similar with a
stylesheet customization of sgmltag. You could put
something like this in your document:
<sgmltag role="dbreference">$$$$$</sgmltag>
and a stylesheet customization that starts with:
<xsl:template match="sgmltag[@role = 'dbreference']">
could generate the link syntax appropriate
to the output.
--
Bob Stayton 400 Encinal Street
Publications Architect Santa Cruz, CA 95060
Technical Publications voice: (831) 427-7796
The SCO Group fax: (831) 429-1887
email: bobs@sco.com
To unsubscribe from this list, send a post to docbook-unsubscribe@lists.oasis-open.org.