Hi Alexey,
I applied your patch, thanks for that.

I agree that for fop1.foxdest mode, it makes no sense to output the dynamically 
generated id values.  I also agree that any element that has an @id | @xml:id 
should get a fox destination in case someone wants to link to it from another 
PDF file.  I think this template suffered much from the copy-paste operation 
that created it.  8^)

I think the following template is the only one needed for that mode:

<xsl:template match="*" mode="fop1.foxdest">
  <xsl:variable name="id">
    <xsl:value-of select="(@id|@xml:id)[1]"/>
  </xsl:variable>
  <xsl:choose>
    <xsl:when test="self::index and $generate.index = 0"/>
    <xsl:when test="$id != ''">
      <fox:destination internal-destination="{$id}"/>
      <xsl:apply-templates select="*" mode="fop1.foxdest"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:apply-templates select="*" mode="fop1.foxdest"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

Let me know if you see anything wrong with it.

If you are wondering about the case with $generate.index = 0, I checked the 
indexing templates to see if that made sense.  As it turns out, an index 
element generates no output at all if $generate.index = 0, even if that index 
element in the document contains manually created indexentry and indexdiv 
elements.  When $generate.index = 1, it will process any indexdiv|indexentry 
elements if they exist, and then if there are none, it calls "generate-index".  
Perhaps that param should have been named 'show.index' instead, but I'm not 
going to change that now.

Bob Stayton
Sagehill Enterprises
[email protected]


From: Alexey Neyman 
Sent: Tuesday, August 27, 2013 1:27 PM
To: DocBook Apps 
Subject: [docbook-apps] Clean up copy-pasted code in fop1.xsl


Hi all,



The attached patch removes an unnecessary call for fop1.foxdest mode template 
which is a copy-paste from bookmark generation code. Should speed up XSLT a bit 
:)



As a related question, does it make sense to limit the template to "*[@id | 
@xml:id] instead of current match pattern? Given that IDs on subsequent runs 
are going to be different for elements without an explicit ID attribute, it 
won't be possible to create a permanent URL to point to such ID-less sections. 
On other hand, current match pattern does not generate destinations for 
tables/figures/equations, even if they have IDs - making impossible to <olink> 
to them.



Regards,

Alexey.



--------------------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to