This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Dave Pawson <davep@dpawson.co.uk> writes:
> On Thu, 2005-05-05 at 16:21 +0200, Jacques Foucry wrote:
> > Is it possible to use abbreviation or kind of aliases in docbook.
[...]
> Yes. If using xml
>
> <!DOCTYPE book SYSTEM "path/to/dtd"[
> <!ENTITY ME2PP " Microsoft Excel 2005 for Palm Pilot">
>
> ]>
>
> later
>
> <para>
> Working with &ME2PP; we do ......
It's also possible to use processing instructions as
pseudo-entities, like this:
<article>
<title>PI pseudo-entity test</title>
<simpara>This is test of expanding a "ME2PP" pseudo-entity into
"<?e ME2PP ?>" using XSLT. The example XSLT stylesheet imports the
<filename>chunk.xsl</filename> driver from the <?e DBXSL ?> package,
but you can have it import the <filename>docbook.xsl</filename>
driver or some other driver instead. The XSLT stylesheet will output
a warning about any pseudo-entity it doesn't recognize -- such as
this one: <?e HOGE-MOGE ?></simpara>
</article>
and then, to expand those pseudo-entities, process your doc
instances with an XSLT stylesheet like this:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/>
<xsl:template match="processing-instruction('e')[normalize-space() = 'ME2PP']">
<xsl:text>Microsoft Excel 2005 for Palm Pilot</xsl:text>
</xsl:template>
<xsl:template match="processing-instruction('e')[normalize-space() = 'DBXSL']">
<xsl:text>DocBook XSL Stylesheets</xsl:text>
</xsl:template>
<xsl:template match="processing-instruction('e')">
<xsl:message>Warning: Unrecognized pseudo-entity: <xsl:value-of
select="normalize-space()"/></xsl:message> <xsl:text>[Unrecognized
pseudo-entity: </xsl:text><xsl:value-of
select="normalize-space()"/><xsl:text>]</xsl:text>
</xsl:template>
</xsl:stylesheet>
Yeah, I know it's a lot more verbose than using real entities.
But not wanting to have to put a doctype declaration/internal DTD
subset in every doc instance (don't otherwise need that if you use
RELAX NG-driven tools for authoring a validation), and lacking any
standard for the equivalent of entities in the post-DTD world,
I've not found any better way to do it.
--Mike
--
Michael Smith
http://logopoeia.com/ http://www.oreillynet.com/pub/au/890
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |