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: How to insert an entity via XSL


use the unparsed-entity-uri() function from XSL.  To use this function, the
entity must be declared with the NDATA notation:

<!ENTITY company_logo SYSTEM "graphics\logo.gif" NDATA GIF>

Then, in your source, "company_logo" must be the value of an attribute
declared as type "ENTITY".  The DocBook graphic, inlinegraphic, imagedata,
etc. tags have an "entityref" attribute, so:

<graphic entityref="company_logo">

could be the source.

A basic XSL template for graphic (to HTML) would be:

<xsl:template match="graphic">
 <img>
  <xsl:attribute name="src">
   <xsl:value-of select="unparsed-entity-uri(@entityref)"/>
  </xsl:attribute>
 </img>
</xsl:template>

This is actually really nice, because the parser will make the relative path
in the entity file into an absolute path.

Jeff

-----Original Message-----
From: Rasmussen Claus-CCLR001 [mailto:claus.rasmussen@motorola.com]
Sent: Wednesday, August 21, 2002 10:19 AM
To: 'docbook-apps@lists.oasis-open.org'
Subject: DOCBOOK-APPS: How to insert an entity via XSL


Hi folks,

I'm using ArborText Epic with our custom DTD to create XML files. Instead of
inserting file system references to graphics it takes all paths and create
entities for each of those. These entities are then used to identify the
graphics.

So, I'm writing some XSL, but I can only get the entity _names_ from the
elements. How do I insert the value of the entity in the output stream.
Theoretically, I'm looking for something like:

<xsl:entity name="entityname"/>

I know this is sort of off-topic on a DocBook list, but this is where I've
found the most XSL skill.

Thanks,
Claus


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