Jump to content

Problem with rx:bookmark


Bleedos
 Share

Recommended Posts

I though that my XSL file was finished before I started working with PDF bookmarks. I am using XEP with rx:bookmark extension. The bookmarks are created, I see them in my PDF file but they all point to the same destination, which is the last destination I specified in my loop.I have an XML file in which I have my 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" />......</type_compte><type_compte type="MC1">      <cheque type="dcn" recto="Images/recto2.jpg" cle="b".........</type_compte>

Here is the code for my bookmarks:

      <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 my templates for "type_compte" and "cheque":

<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:template>

The ids of my blocks elements are "cle" for "cheque" and "type" for "type_compte".The bookmarks appear in my PDF file. Here is what I get in my PDF:

-EOP   |- a   |- b   |- c   |- d-MC1   |- e   |- f   |- g   |- h   |- i

If I click on "c", it will point me to "i". The same thing with every other bookmark.If I click on "EOP", it will point me to "MC1".What do I do wrong??

Link to comment
Share on other sites

OMG. I have no idea of this "rx" thing. I could tell you that you could use the generate-id() function of XSLT to create the "link" though. Check the XSLT reference of W3Schools for details on the generate-id() function and let me know the result :) .

Link to comment
Share on other sites

OMG. I have no idea of this "rx" thing. I could tell you that you could use the generate-id() function of XSLT to create the "link" though. Check the XSLT reference of W3Schools for details on the generate-id() function and let me know the result :) .

I thought of using generate-id() but, what do I use in the rx:bookmark? If I call generate-id() in the <fo:block> and in the <rx:bookmark>, it will generate two different ids?? If I only call it from the <fo:block>, do I have access to it from <rx:bookmark>. I am not sure of the way XSL files are processed. Is there an order? If the <fo:root> is processed first, I don't have access to the id of my <fo:block> because it is in a template?By the way, what does OMG mean? Thank you :)
Link to comment
Share on other sites

That RenderX still doesn't ring any bells. Hope I'll find something on the site...OMG means "Oh My God". It's a "chat dialect" in other words. Like "btw" means "By The Way", etc.The only trick with generate-id() is that it's argument is a node set. A unique identifier is generated for this node set. The ID is repeated if the node set is. So this means if you use for example "generate-id(@type)" in two places, same IDs would be generated for both places. If you have something like

<xsl:for-each select="something"><a href="generate-id(@type)"><xsl:value-of select="."/></a></xsl:for-each>

And have 2 "something"s in your XML, this would mean an output of 2 IDs in this cycle. However, when you start a new cycle with the same node set, like in the example of the generate-id() in the reference, you start generating the same IDs from the start, thus creating something like a virtual link between them.Just remember to use the same node set in both the bookmark and the actual point where it should lead.

Link to comment
Share on other sites

Thank you very much. Someone from the xep-support list answered me. He told me to put "{ }" around my @type and @cle. It worked.Probably. I am looking at your solution and I think it would also work.Thank you again for your help. :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...