OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook] using entitites in XSL


Hi Roman,

On Sonntag, 4. November 2007, Roman Banks wrote:
> [... customization in footer template with entities...]
>
>     </xsl:when>
>     <xsl:when test="$double.sided != 0 and
> $position='center'">
>       <xsl:text>&j_copyright;</xsl:text>
>     </xsl:when>
>
> As you can see, I would like to use an entity
> (&j_copyright) instead of a regular copyright text. I
> defined this entity (which contains the copyright
> info) in my definitions.ent file where I store all my
> entities which I use in my XML sources. In my XSL
> customization layer, I called definitions.ent via
> xi:include. However, as you can already guess, this
> does not work when I try to compile a PDF.

I am not sure, if XIncludes are resolved correctly inside a XSLT 
stylesheet. Even if they are resolved it can not work as your entity 
definitions are not well-formed XML.


> The compiler says that the entity is not defined. Is there
> any way to process entities inside XSL?

Use the following steps:

1. Modify your stylesheet and insert the following DOCTYPE declaration:

-----------[ customization.xsl ]-------------------
<!DOCTYPE xsl:stylesheet
[
  <!-- Point to the correct path: -->
  <!ENTITY % ents SYSTEM "definitions.ent">
  %ents;
]>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:fo="http://www.w3.org/1999/XSL/Format";>

 <!-- Insert your templates here -->
</xsl:stylesheet>
---------------------------------------------------


2. Write a file "myentities.ent" with the following content (you did that 
already):

---------------------[ definitions.ent ]------------
<!ENTITY j_copyright "This work is copyright of...">
---------------------------------------------------

Insert only text inside the j_copyright entity. Any decent XSLT processor 
should be able to resolve your entities.


Hope this helps,
Tom

-- 
Thomas Schraitle


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]