How to add/remove a picture & list of authors on cover page

Having trouble installing Oxygen? Got a bug to report? Post it all here.
jnielsen
Posts: 58
Joined: Fri Sep 12, 2008 12:12 am

How to add/remove a picture & list of authors on cover page

Post by jnielsen »

How do I edit the content on the cover page to list/insert Author's names and/or put a picture on it (using a DITA PDF transform)? I have yet to figure out how to do that.

Also if I want to remove either of those elements on the cover page should I edit the relevant section in the .xsl transforms? Is there perhaps a DocBook transform that will look better than the DITA transform as far as a simple cover page (no picture) is concerned? I'm making a HowTo guide that will have many sections, so I basically just want a cover page with a title on it (and possibly the Author's/Instituion's name under it) followed by the Contents page (there is a fairly useless blank page in between the Cover and Contents page which I don't need w/ the DITA transform) and then the actual content.

Any help would be appreciated.

Thanks,

~Josh
Radu
Posts: 9086
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to add/remove a picture & list of authors on cover page

Post by Radu »

Hi,

Instructions on how to remove the first pages can be found here:
http://www.oxygenxml.com/forum/post10516.html

Basically the first page of the PDF output should present the information that you may insert in a map using topicmeta like:

Code: Select all


 <topicmeta>
<author>Radu</author>
<copyright>
<copyryear year="2008"/>
<copyrholder>Radu</copyrholder>
</copyright>
</topicmeta>
but it does not seem to work very good.

The text "[cover art/text goes here]" can be modified to some custom user text or image.
There is a file called "dita2fo-shell.xsl" in the {OXYGEN_INSTALL_DIR}/frameworks/dita/DITA-OT/xsl/ directory.
Just modify the "place-cover-art" template to suit your needs.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
jnielsen
Posts: 58
Joined: Fri Sep 12, 2008 12:12 am

Re: How to add/remove a picture & list of authors on cover page

Post by jnielsen »

Radu wrote:Hi,

Instructions on how to remove the first pages can be found here:
http://www.oxygenxml.com/forum/post10516.html

Basically the first page of the PDF output should present the information that you may insert in a map using topicmeta like:

Code: Select all


 <topicmeta>
<author>Radu</author>
<copyright>
<copyryear year="2008"/>
<copyrholder>Radu</copyrholder>
</copyright>
</topicmeta>
but it does not seem to work very good.

The text "[cover art/text goes here]" can be modified to some custom user text or image.
There is a file called "dita2fo-shell.xsl" in the {OXYGEN_INSTALL_DIR}/frameworks/dita/DITA-OT/xsl/ directory.
Just modify the "place-cover-art" template to suit your needs.

Regards,
Radu
So is "topic meta" the thing that defines the parameters that are passed to the xsl transform for the picture, author's list, etc? And do you manually code that (topic meta information) in from the "text view" tab rather than specifying some setting in the document itself?

I've viewed that dita2fo-shell.xsl file rather carefully (and even edited it in a few places), but I still can't figure out where the parameters come from (how they are passed). They aren't hard coded into the xsl are they? Is that where topicmeta comes in? And if you would be so kind could you give an actual .xml code example (sample) that would make the PDF output display a list of, say, 3 authors and a cover picture? That would be much appreciated.

P.S. I'm also wanting to make my own output to display the date on the cover page (and have "hardcoded" a date into the xsl for the time-being), but I will need to know how to appropriately pass parameters first so it can be dynamic.

Thanks,

~Josh
Radu
Posts: 9086
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to add/remove a picture & list of authors on cover page

Post by Radu »

Hi Josh,

The DITA Map indeed needs to be edited in the "Text" or "Author" page to insert topic meta into it like:

Code: Select all


<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN"
"../../frameworks/dita/DITA-OT/dtd/map.dtd">
<map title="Eclipse content aggregated by a map">
<topicmeta>
<author>Radu</author>
<copyright>
<copyryear year="2008"/>
<copyrholder>Radu</copyrholder>
</copyright>
</topicmeta>
<topicref href="tasks/garagetaskoverview.xml" type="concept"/>
</map>
As for the cover image, unfortunately you have to edit the "dita2fo-shell.xsl" to insert a link to an image.
Find in the 'dita2fo-shell.xsl' file the text: '[cover art/text goes here]'.
Replace the whole fo:block with:

<fo:block margin-top="2pc" font-family="Helvetica" border-style="dashed" border-color="black" border-width="thin" padding="6pt" text-align="center">
<fo:external-graphic src="url(image/logo.jpeg)"/>
</fo:block>

The company 'logo.jpeg' image will have to be located in the output directory in a folder names "images" so that it is located
relative to the "fo" file.

The parameters are passed to the XSL files through the build files used by the DITA Open Toolkit ANT Transformation.
See OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\build_dita2xhtml.xml build file for more details.
In your turn, you can set additional parameters to the build files through the Oxygen scenarios, parameters which then you can pass from the build files to the stylesheets.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
jnielsen
Posts: 58
Joined: Fri Sep 12, 2008 12:12 am

Re: How to add/remove a picture & list of authors on cover page

Post by jnielsen »

Radu wrote:Hi Josh,

The DITA Map indeed needs to be edited in the "Text" or "Author" page to insert topic meta into it like:
....
In your turn, you can set additional parameters to the build files through the Oxygen scenarios, parameters which then you can pass from the build files to the stylesheets.

Regards,
Radu
Thank you! Very helpful. One more thing if you will indulge me. Since I am not primarily a programmer I only vaguely understand how the xsl code works, for these following sections what do the sections in bold account for?

<fo:block font-size="11pt" font-weight="bold" line-height="1.5">
<xsl:text>[vertical list of authors]</xsl:text>
</fo:block>
<xsl:for-each select="//author">
<xsl:variable name="authorid1" select="generate-id(.)"></xsl:variable>
<xsl:variable name="authorid2" select="generate-id(//author[.=current()])"></xsl:variable>
<xsl:if test="$authorid1=$authorid2">
<fo:block font-size="11pt" font-weight="bold" line-height="1.5">
[<xsl:value-of select="."></xsl:value-of>]
</fo:block>
Does //author specify <author> tags? Also, although not nearly as important, I am curious as to where the element being referenced by the 'current()' function is located (which document the element being referenced is in).

Also consider this code:
<fo:block font-size="30pt" font-weight="bold" line-height="140%">
<xsl:choose>
<xsl:when test="//*[contains(@class,' bkinfo/bkinfo ')]">
<xsl:value-of select="//*[contains(@class,' bkinfo/bkinfo ')]/*[contains(@class,' topic/title ')]"></xsl:value-of>

<xsl:apply-templates select="//*[contains(@class,' bkinfo/bkinfo ')]/@id"></xsl:apply-templates>
</xsl:when>
<xsl:when test="@title"><xsl:value-of select="@title"></xsl:value-of></xsl:when>
<xsl:otherwise><xsl:value-of select="//*/title"></xsl:value-of></xsl:otherwise>
</xsl:choose>
</fo:block>
What does @class specify? Would a proper interpretation of "//*[contains(@class,' bkinfo/bkinfo ')" be, "All elements with the attribute "class" that contain '<bkinfo>' tags"? And 'bkinfo/bkinfo' & 'topic/title' look like they are hierarchically referencing some element. Are those referencing (nested) tags somewhere? If so where are they located & what are other such " * / * " options that could be used?

Edit: I found a page on w3schools.com that identified the select=*/* items as XPath references. But which xml file has those elements like 'bkinfo/bkinfo', etc.? The <topicmeta> section doesn't like it if I try to create a <bkinfo> tag inside it. I think the "where?" questions are central to what I'm trying to ask.

I apologize for the volume of questions, but this will help me out alot.

Thank You,

~Josh
Radu
Posts: 9086
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to add/remove a picture & list of authors on cover page

Post by Radu »

Hi Josh,

See some answers below:

//author
Is an XPath expression meaning each "author" tag in the document.

<xsl:if test="$authorid1=$authorid2">
The if clause is used to only output unique author names with the help of the 2 xsl:variable's above it. For example, if my name is in the Author list twice, only one occurence of my name will appear in the PDF Authors list.

current() means the current selected XML node in the current stylesheet context. In this particular case, it means the current iterated author.

//*[contains(@class,' bkinfo/bkinfo ')] means:
For all elements in the document (//*) which have a class attribute which contains the value bkinfo/bkinfo

*[contains(@class,' topic/title ')] means:
All children of the current context (see above) which have a class attribute containing the value topic/title . This actually means all <title> elements (because titles have that value in the class name).

Each DITA element has a class attribute (see the Oxygen Attributes view when the caret is in an element) with a certain predefined value.
Stylesheets usually select the elements not by name but by the class value so that, if you extend the DITA grammar by adding your own tag names but use existing values for the class attribute, the stylesheets will work without modifications. It's like saying that, if 2 element tags have the same class, they are of the same kind.
These extensions are called DITA specializations.
See http://docs.oasis-open.org/dita/v1.0/ar ... ation.html

Read more about XPath 1.0 selectors here:http://www.zvon.org/xxl/XPathTutorial/G ... mples.html



Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
jnielsen
Posts: 58
Joined: Fri Sep 12, 2008 12:12 am

Re: How to add/remove a picture & list of authors on cover page

Post by jnielsen »

Terrific! Thanks for all the help.

~Josh
Post Reply