Re: [xep-support] Problem with rx:bookmark

From: Volodymyr Mykhailyk <Volodymyr.Mykhailyk@intelliarts.com>
Date: Fri May 05 2006 - 08:05:36 PDT
Hi Sebastien,
it is better to use "generate-id()" function in XSLT and process document twice. This function will generate uniq id for all elements end they will be dynamic. We always using this function for such and other purposes. Try to change your XSL with example below.
- - - - - - - - - -
      <rx:outline>
         <xsl:for-each select="//type_compte">
            <rx:bookmark internal-destination="{generate-id()}">
            <rx:bookmark-label><xsl:value-of select="@type"/></rx:bookmark-label>
            <xsl:for-each select="cheque">
               <rx:bookmark internal-destination="{generate-id()}">
               <rx:bookmark-label><xsl:value-of select="@cle"/></rx:bookmark-label>
               </rx:bookmark>
            </xsl:for-each>
            </rx:bookmark>
         </xsl:for-each>
      </rx:outline>
- - - - - - - - - -

Here are the <fo:block> parts of the XSL:
- - - - - - - - - -
<xsl:template match="type_compte">
   <fo:block id="{generate-id()}" text-align="left" font-weight="bold" font-size="11pt" space-before.minimum="12pt">
      <xsl:value-of select="@type"/>
   </fo:block>
   <fo:block>
      <xsl:apply-templates />
   </fo:block>
</xsl:template>
- - - - - - - - - -
<xsl:template match="cheque">
   <!-- Images recto et verso -->
   <fo:block id="{generate-id()}" text-align="left" space-after.minimum="3pt">
      <xsl:choose>
         <xsl:when test="@type = 'dcn'">
...
</xsl:template>
- - - - - - - - - -
BTW. Question to RenderX support team. Can I answer to question from other users. Or it is better not to do this?
--
Volodymyr.Mykhailyk
IntelliArts
Sébastien CLERMONT wrote:
Hi everyone.  My XSL file is almost done.  All that remain is bookmarks.  I have an XML file and need to produce a PDF with Images and bookmarks to these images.  The problem is that the content of the XML file is dynamic.  It can containt a reference from 1 to a 1000 images.  So I can't have <fo:block> with static ids and use these ids as internal-destination.

In my XSL file, I have my rx:outline section in which I loop.  The bookmarks appear in the PDF file but they all point to the same destination which is the last destination I defined for each level of bookmark.

Here is a part of the XML data:
- - - - - - - - - -
   <type_compte type="EOP">

      <cheque type="dcn" recto="Images/recto1.jpg" cle="a"
              verso="Images/verso1.jpg"
              date="12 MAI 2005"
              nocheque="122"
              montant="1500.00"
              noref="12345678910" />

      <cheque type="rto" date="15 MAI 2005" cle="b"
...
   </type_compte>
- - - - - - - - - -

Here is the <rx:outline> part of the XSL:
- - - - - - - - - -
      <rx:outline>
         <xsl:for-each select="//type_compte">
            <rx:bookmark internal-destination="@type">
            <rx:bookmark-label><xsl:value-of select="@type"/></rx:bookmark-label>
            <xsl:for-each select="cheque">
               <rx:bookmark internal-destination="@cle">
               <rx:bookmark-label><xsl:value-of select="@cle"/></rx:bookmark-label>
               </rx:bookmark>
            </xsl:for-each>
            </rx:bookmark>
         </xsl:for-each>
      </rx:outline>
- - - - - - - - - -

Here are the <fo:block> parts of the XSL:
- - - - - - - - - -
<xsl:template match="type_compte">
   <fo:block id="@type" text-align="left" font-weight="bold" font-size="11pt" space-before.minimum="12pt">
      <xsl:value-of select="@type"/>
   </fo:block>
   <fo:block>
      <xsl:apply-templates />
   </fo:block>
</xsl:template>
- - - - - - - - - -
<xsl:template match="cheque">
   <!-- Images recto et verso -->
   <fo:block id="@cle" text-align="left" space-after.minimum="3pt">
      <xsl:choose>
         <xsl:when test="@type = 'dcn'">
...
</xsl:template>
- - - - - - - - - -

In attachment, you can see a screenshot of the result.  If I click on "EOP" or "MC1", it brings me to "MC1".  If I click on [a, b, c, d, e, f, g, h, i], it brings me to i.

What do I do wrong?  Is that possible to have dynamic ids in fo:blocks and use them in the rx:bookmark tag?

Your help would really be appreciated.  Thank you.




-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo@renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/terms-of-service.html

picture
Received on Fri May 5 08:32:44 2006

This archive was generated by hypermail 2.1.8 : Fri May 05 2006 - 08:32:44 PDT