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]

Re: [docbook-apps] Alternative to internal entities?


Another approach is to let the stylesheet resolve a special element,
something like this:

<phrase role="entity">wrkngName</phrase>

<xsl:template match="phrase">
  <xsl:choose>
    <xsl:when test="@role = 'entity'">
      <xsl:variable name="entity"><xsl:value-of select="."/></xsl:variable>
      <xsl:choose>
        <xsl:when test="$entity = 'wrkngName'">
          <xsl:text>My Real Product Name</xsl:text>
        </xsl:when>
        <!-- Other entity expansions here -->
      </xsl:choose>
    </xsl:when>
    <xsl:otherwise>
      <xsl:apply-imports/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

The nice thing about this approach is that you don't have to mess with the
DTD to get such text expansion.  You define the expansion by the stylesheet
at processing time.  Validation is another issue, of course.

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net


----- Original Message ----- 
From: "Paul A. Hoadley" <paulh@logicsquad.net>
To: <docbook-apps@lists.oasis-open.org>
Sent: Tuesday, April 27, 2004 1:21 AM
Subject: [docbook-apps] Alternative to internal entities?

Hello,

Obviously this is not a DocBook-specific question, but are there any
alternatives to internal entities for macro-like text substitution?  I
have pretty much completely moved from PSGML to nxml-mode for DocBook
editing, and I would like to try and eliminate use of DOCTYPEs.
However, I quite like declaring entities in the internal subset for
simple text substitution.  Is there a lighter-weight alternative to
XInclude?  For one application, I used an entity to refer to the
working name for a software package in case it changed.  It seems a
bit excessive to XInclude a separate file to expand what would be,
say, a two character entity to the name of a software package.  Is
there an alternative?


-- 
Paul.

mailto:paulh@logicsquad.net



To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.


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