Pages: 1
Print
Author Topic: What xsl file controls PDF overall page order, in bookmaps for instance?  (Read 6082 times)
jepry
Member

Posts: 19


« on: May 12, 2011, 09:40:50 AM »

This is somewhat a continuation of this:

http://forums.xmetal.com/index.php/topic,1313.0.html

but really a separate question:

Can anyone just tell me what in the DITA OT controls the overall page order for a PDF published from a bookmap (a user guide with a bookmap as the top structure)?

I've learned enough about this to realize that the XMetal implementation of the DITA OT is its own animal, thus trying out ideas from other non-XMetal forums seems to run into walls because the DITA OT collection is slightly-to-hugely different in each.

I've successfully tweaked a lot of other PDF output elements as I've noted in other comments sprinkled below, but the creation of the title page is just such a complicated process that modifying it has so far eluded me. I've found a number of suggestions elsewhere online for adding logos for example but none actually work, which on closer examination looks to me due to differences in the DITA OT setup as I say-- files don't match, I don't have xsl files they mention, etc.

I've found how I can just suppress the "front matter" entirely, and if I could then just insert a topic, page, anything, above the TOC to appear as the first page with everything I want on it (title, two subtitles, paragraph, and logo-- all of which i can put in a topic effortlessly) I'd be all set. I can even just do this by modifying the PDF afterwards in Acrobat Pro, but we really need something we can generate as output from XMetal.

What I'd like to do is have the TOC appear later in the guide, after a title page and copyright page that I've created, and I can simply suppress the front matter so as to get rid of the current title page which has only title and subtitle.

root-processing.xsl seems to call the templates for the TOC, front-matter, and so on, but has nothing to do with what order all these appear, unless I'm mistaken.

I realize after looking at this that something like Xmetal's Top Leaf Plugin would be the tool for this for someone not an expert in xslt, but that's not going to happen in the next few weeks and this has to get done so any ideas much appreciated, code, samples, tips....

Xmetal 6.0, XMetal Enhanced PDF via Render X XEP
Logged
gcrews
Member

Posts: 265


« Reply #1 on: May 12, 2011, 01:50:17 PM »

The rootTemplate in xmfo\xsl\fo\root-processing.xsl does control the order by the order that the other templates are called in and the order that those templates call other templates.  When there is a apply-templates instead of call template it may use the priority set on the templates as well to determine the order.
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #2 on: May 13, 2011, 10:59:34 AM »

If you are following instructions elsewhere they will likely be for the "pdf2" transtype that the DITA OT includes. People not running XMetaL Author Enterprise do not yet have access to "XMetaL Enhanced PDF Output via RenderX XEP" (that may sound obvious, but ultimately I'd like us to contribute our code back to the SourceForge project and that has yet to happen).

The DITA OT includes two PDF transtypes "pdf" and "pdf2". By way of this numbering scheme portions of our documentation refer to ours as "pdf3" which cloned and then modified "pdf2" to primarily add proper support for bookmaps and fix a number of problems. We expose "pdf2" in our UI as the deliverable we call "Book via RenderX". It is disabled by default but can easily be enabled by unchecking a checkbox labelled: "Disable use of this deliverable type".

I mention this because if you seriously wish to make modifications to "pdf2" then instructions you find should work.

Note that we also include the "pdf" transtype which was the original PDF output. It does not rely on RenderX but uses Apache FOP instead. It is exposed in our UI (but disabled by default) as "PDF via FO with default processing".
Logged
gcrews
Member

Posts: 265


« Reply #3 on: May 13, 2011, 11:59:38 AM »

That would be excellent to have RenderX XEP code contributed to the SourceForge project.  Or at the very least in the form of a plugin (is it already?) that can be integrated into the toolkit.  I have been itching to customize the toolkit some more to make out output look better. I have been holding off on making any major customization though because the toolkit with XMetal seems fairly out of date.  I would use 1.5.2 from the project but I’m afraid that there would be too much customization and formatting loss in the pdf output that is in place in the RenderX XEP output.
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #4 on: May 13, 2011, 01:41:13 PM »

The "XMetaL Enhanced PDF via RenderX XEP" code was written as a plug-in.

If you are familiar with DITA OT plug-ins you will see that all the necessary files to meet the plug-in requirements for the DITA OT are located here:
<DITA OT>\demo\xmfo

It essentially mirrors the PDF2 (originally created by Idiom) plug-in's structure which is located here:
<DITA OT>\demo\fo
Logged
jepry
Member

Posts: 19


« Reply #5 on: May 13, 2011, 06:16:47 PM »

If you are following instructions elsewhere they will likely be for the "pdf2" transtype that the DITA OT includes.....

Ah, that explains it. I'm actually having more success getting what I want just by plunging into the existing DITA OT and experimenting but was wondering why nothing I tried from elsewhere seemed to ever work, even if it would just have been useful as a learning tool or to then adjust to what I needed and so on.

I'll keep in mind the option of using Book Render X just to see some of the other suggestions and have them actually work, but in the meantime, in this xm_titlepage.xsl file:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format"
    version="1.0">
    <!-- title page, frontmatter. see also frontMatter.xsl -->
    <xsl:template name="createFrontMatter">
       
        <!-- title page -->
        <fo:page-sequence master-reference="front-matter"
            xsl:use-attribute-sets="__force__page__count">
            <!--<xsl:call-template name="insertFrontMatterStaticContents"/>-->
            <fo:flow flow-name="xsl-region-body">
                <fo:block xsl:use-attribute-sets="__frontmatter">
                   
                    <!-- title, version, modification, dates  -->
                    <fo:block-container xsl:use-attribute-sets="xm.titlepage.titleblock.container" ><!--was __frontmatter__title__container-->
                        <fo:block xsl:use-attribute-sets="xm.titlepage.title"><!--was __frontmatter__title-->
                            <xsl:value-of select="$xmDocumentTitle"/>
                        </fo:block>
                       
                        <xsl:for-each select="$map//*[contains(@class, ' bookmap/booktitlealt ')]">
                            <fo:block xsl:use-attribute-sets="xm.titlepage.subtitle">
                                <xsl:value-of select="."/>
                            </fo:block>
                        </xsl:for-each>

                    </fo:block-container >
                       
                            <!--display book info-->   
                    <fo:block-container xsl:use-attribute-sets="xm.titlepage.infoblock.container">
                        <fo:block xsl:use-attribute-sets="xm.titlepage.orgname">
                            <xsl:value-of select="$map//*[contains(@class, ' bookmap/organization ')]"/>
                        </fo:block>       
                        <xsl:for-each select="$map//*[contains(@class, ' bookmap/bookpartno ')]">                         
                            <fo:block xsl:use-attribute-sets="xm.titlepage.partno">
                                <xsl:value-of select="."/>
                            </fo:block>                               
                        </xsl:for-each>                       
                    </fo:block-container>                   
                </fo:block>
            </fo:flow>
        </fo:page-sequence>
       
    </xsl:template>
 

</xsl:stylesheet>

... what's the code in your version for adding a logo as an image below that subtitle block? ;)

Thanks in advance and also in the other direction, good response, that helps a lot.
Logged
jepry
Member

Posts: 19


« Reply #6 on: May 14, 2011, 04:40:38 PM »


Have you checked it once, i think code is included in already working fine.

I'm not sure what you mean, sorry, there's no code at all for the graphic in what I posted.

On the other hand, I just got this to work, for what it's worth, by adding an <fo> block that I found online for adding an image to the title page, like this:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format"
    version="1.0">
    <!-- title page, frontmatter. see also frontMatter.xsl -->
    <xsl:template name="createFrontMatter">
       
        <!-- title page -->
        <fo:page-sequence master-reference="front-matter"
            xsl:use-attribute-sets="__force__page__count">
            <!--<xsl:call-template name="insertFrontMatterStaticContents"/>-->
            <fo:flow flow-name="xsl-region-body">
                <fo:block xsl:use-attribute-sets="__frontmatter">
                   
                    <!-- title, version, modification, dates  -->
                    <fo:block-container xsl:use-attribute-sets="xm.titlepage.titleblock.container" ><!--was __frontmatter__title__container-->
                        <fo:block xsl:use-attribute-sets="xm.titlepage.title"><!--was __frontmatter__title-->
                            <xsl:value-of select="$xmDocumentTitle"/>
                        </fo:block>


                        <xsl:for-each select="$map//*[contains(@class, ' bookmap/booktitlealt ')]">
                            <fo:block xsl:use-attribute-sets="xm.titlepage.subtitle">
                                <xsl:value-of select="."/>
                            </fo:block>
                        </xsl:for-each>

       <fo:block text-align="center" width="100%">
   <fo:external-graphic src="url({concat($artworkPrefix, '/Customization/OpenTopic/common/artwork/logo.png')})"/>
       </fo:block>
                       

                    </fo:block-container >
                       
                            <!--display book info-->   
                    <fo:block-container xsl:use-attribute-sets="xm.titlepage.infoblock.container">
                        <fo:block xsl:use-attribute-sets="xm.titlepage.orgname">
                            <xsl:value-of select="$map//*[contains(@class, ' bookmap/organization ')]"/>
                        </fo:block>       
                        <xsl:for-each select="$map//*[contains(@class, ' bookmap/bookpartno ')]">                         
                            <fo:block xsl:use-attribute-sets="xm.titlepage.partno">
                                <xsl:value-of select="."/>
                            </fo:block>                               
                        </xsl:for-each>                       
                    </fo:block-container>                   
                </fo:block>
            </fo:flow>
        </fo:page-sequence>
       
    </xsl:template>
 

</xsl:stylesheet>


And with that, our logo is on the front page after the subtitle. I also had to insert the logo.png graphic file itself in:

...DITA_OT\demo\xmfo\Customization\common\artwork


Once I knew where to put things, which is completely different from the locations that all of the examples I find online talk about, it all works.

Logged
Pages: 1
Print
Jump to:  

email us