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


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

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

Subject: Re: [docbook-apps] Clean up copy-pasted code in fop1.xsl

Hi Bob,


Yes, the suggested template makes sense.


I did a bit of further digging, though, and found that there's a way to generate the same IDs on the document by setting $generate.consistent.ids parameter to 1. In that case, it would be possible to create links to a given element - which would stay valid even if the document is rebuilt (but only as long as it is unchanged). I am not sure if it vindicates the creation of internal destination for ID-less sections, though. I still think the template you suggest makes much more sense as a default.





On Tuesday, August 27, 2013 02:13:09 PM Bob Stayton wrote:

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: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:apply-templates select="*" mode="fop1.foxdest"/>

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

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.





To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org

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