Pages: 1
Print
Author Topic: Excluding page numbers in cross-references  (Read 8167 times)
carmstrong
Member

Posts: 11


« on: December 08, 2010, 03:14:25 PM »

In XMetaL 5.5 SP1 is there a way to exclude the page number when inserting a cross-reference to a topic? For example, I've created a revision history table as an appendix. The table references each chapter in the document and the changes made, if any. While page numbers are necessary when cross-references are used within the document, they are not necessary in the revision history table.

I've attached an example table for your reference. Any information you can provide would be helpful. Thanks.


* Example revision history table.png (19.64 KB, 529x299 - viewed 5076 times.)
« Last Edit: December 08, 2010, 03:16:37 PM by carmstrong » Logged
gcrews
Member

Posts: 265


« Reply #1 on: December 08, 2010, 03:42:06 PM »

You might want to take a look at the insertPageNumberCitation xsl template in links.xsl in xmfo ( assuming your using renderX). You can eather change/override that template or take out the calls to it.  If you haven’t worked with customizing the toolkit files before, you might want to read though the Appendix D of the user guide to know what files to edit.
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #2 on: December 08, 2010, 04:07:41 PM »

The file you need to modify will also depend on which 'deliverable' you are using to generate your PDF (there are three different ones).

If you are using "XMetaL Enhanced PDF via RenderX XEP" then the existing section in links.xsl looks like this:

Quote
   <xsl:template name="insertPageNumberCitation">
        <xsl:param name="isTitleEmpty"/>
        <xsl:param name="destination"/>
        <xsl:param name="element"/>

        <xsl:choose>
            <xsl:when test="not($element) or ($destination = '')"/>
            <xsl:when test="$isTitleEmpty">
                <fo:inline>
                    <xsl:call-template name="insertVariable">
                        <xsl:with-param name="theVariableID" select="'Page'"/>
                        <xsl:with-param name="theParameters">
                            <pagenum>
                                <fo:inline>
                                    <fo:page-number-citation ref-id="{$destination}"/>
                                </fo:inline>
                            </pagenum>
                        </xsl:with-param>
                    </xsl:call-template>
                </fo:inline>
            </xsl:when>
            <xsl:otherwise>
                <fo:inline>
                    <xsl:call-template name="insertVariable">
                        <xsl:with-param name="theVariableID" select="'On the page'"/>
                        <xsl:with-param name="theParameters">
                            <pagenum>
                                <fo:inline>
                                    <fo:page-number-citation ref-id="{$destination}"/>
                                </fo:inline>
                            </pagenum>
                        </xsl:with-param>
                    </xsl:call-template>
                </fo:inline>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

At minimum you would need additional conditional logic in there to check to see if the link is inside a table. However, you might have links inside tables elsewhere, so if you don't want to suppress page numbers for links in all tables you might need to add something to your XML to identify this table as being special, perhaps using the outputclass attribute for example: <table outputclass="docUpdateTable">. Or you could key off of something else. Maybe you never want links inside tables inside an 'appendix' to have page numbers. For bookmaps you might be able to check if the table is in an appendix. For regular maps you might try to just check to see if the topic title contains the text "appendix".

The the outputclass type of solution the conditional logic inside the XSLT template might have this kind of logic:

xsl:when has ancestor "table" and "table" has @outputclass = "docUpdateTable" do not include page number
xsl:otherwise include page number (ie: existing behavior)
« Last Edit: December 08, 2010, 04:09:12 PM by Derek Read » Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #3 on: December 08, 2010, 05:39:52 PM »

Here's the section I quoted in my previous message modified to exclude the page number for any xref that appears in any table, with the blue part being new code:

   <xsl:template name="insertPageNumberCitation">
        <xsl:param name="isTitleEmpty"/>
        <xsl:param name="destination"/>
        <xsl:param name="element"/>

        <xsl:choose>
            <xsl:when test="not($element) or ($destination = '')"/>
            <xsl:when test="$isTitleEmpty">
                <fo:inline>
                    <xsl:call-template name="insertVariable">
                        <xsl:with-param name="theVariableID" select="'Page'"/>
                        <xsl:with-param name="theParameters">
                            <pagenum>
                                <fo:inline>
                                    <fo:page-number-citation ref-id="{$destination}"/>
                                </fo:inline>
                            </pagenum>
                        </xsl:with-param>
                    </xsl:call-template>
                </fo:inline>
            </xsl:when>
           <xsl:when test="ancestor::table">
                         <fo:inline>
                    <xsl:call-template name="insertVariable">
                  <!--<xsl:with-param name="theVariableID" select="'On the page'"/>-->
                        <xsl:with-param name="theParameters">
                            <pagenum>
                                <fo:inline>
                                    <fo:page-number-citation ref-id="{$destination}"/>
                                </fo:inline>
                            </pagenum>
                        </xsl:with-param>
                    </xsl:call-template>
                </fo:inline>
            </xsl:when>   

            <xsl:otherwise>
                <fo:inline>
                    <xsl:call-template name="insertVariable">
                  <xsl:with-param name="theVariableID" select="'On the page'"/>
                        <xsl:with-param name="theParameters">
                            <pagenum>
                                <fo:inline>
                                    <fo:page-number-citation ref-id="{$destination}"/>
                                </fo:inline>
                            </pagenum>
                        </xsl:with-param>
                    </xsl:call-template>
                </fo:inline>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>


Here's the same section again but this time modified to exclude the page number for any xref that appears in tables with @outputclass="docUpdateTable", with the blue part being the new code:

   <xsl:template name="insertPageNumberCitation">
        <xsl:param name="isTitleEmpty"/>
        <xsl:param name="destination"/>
        <xsl:param name="element"/>

        <xsl:choose>
            <xsl:when test="not($element) or ($destination = '')"/>
            <xsl:when test="$isTitleEmpty">
                <fo:inline>
                    <xsl:call-template name="insertVariable">
                        <xsl:with-param name="theVariableID" select="'Page'"/>
                        <xsl:with-param name="theParameters">
                            <pagenum>
                                <fo:inline>
                                    <fo:page-number-citation ref-id="{$destination}"/>
                                </fo:inline>
                            </pagenum>
                        </xsl:with-param>
                    </xsl:call-template>
                </fo:inline>
            </xsl:when>
           <xsl:when test="ancestor::table[@outputclass='docUpdateTable']">
                         <fo:inline>
                    <xsl:call-template name="insertVariable">
                  <!--<xsl:with-param name="theVariableID" select="'On the page'"/>-->
                        <xsl:with-param name="theParameters">
                            <pagenum>
                                <fo:inline>
                                    <fo:page-number-citation ref-id="{$destination}"/>
                                </fo:inline>
                            </pagenum>
                        </xsl:with-param>
                    </xsl:call-template>
                </fo:inline>
            </xsl:when>

            <xsl:otherwise>
                <fo:inline>
                    <xsl:call-template name="insertVariable">
                  <xsl:with-param name="theVariableID" select="'On the page'"/>
                        <xsl:with-param name="theParameters">
                            <pagenum>
                                <fo:inline>
                                    <fo:page-number-citation ref-id="{$destination}"/>
                                </fo:inline>
                            </pagenum>
                        </xsl:with-param>
                    </xsl:call-template>
                </fo:inline>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>


These have been tested with the links.xsl file that is used by the "XMetaL Enhanced PDF via RenderX" deliverable. I think the file for "Book via RenderX" is the same or similar.
« Last Edit: December 08, 2010, 06:07:12 PM by Derek Read » Logged
carmstrong
Member

Posts: 11


« Reply #4 on: December 09, 2010, 09:47:25 AM »

This is very helpful. Thanks for the information!
Logged
Pages: 1
Print
Jump to:  

email us