[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Titleabbrev in outer margin
Just for the record. I found the solution by myself. The following xpath expression gives me the position of the article element in the xml tree: <xsl:param name="article.position"> <xsl:value-of select="count(ancestor-or-self::article/preceding- sibling::article)" /> </xsl:param> Based on that, I managed to calculate the offset value for the fo:block that contains the titleabbrev. /frank 24 mar 2010 kl. 18.46 skrev Frank Arensmeier: > Sorry to bother you all. Any ideas regarding this issue? > Thank you. > > /frank > > 23 mar 2010 kl. 13.02 skrev Frank Arensmeier: > >> Hello list. >> >> I am not a XSL programmer, so I kindly ask you to bear with me. I >> have a docbook compilant XML file (an operating instruction) that >> contains several different languages. Basic outline of the XML file >> is: >> >> <part> >> <article lang="en"> >> <title /> >> <titleabbrev>English</titleabbrev > >> [...] >> </article> >> <article lang="de"> >> <title /> >> <titleabbrev>Deutsch</titleabbrev> >> [...] >> </article> >> </part> >> >> What I like to accomplish is putting the language names into the >> outer margin of my pdf. I found an example in the mailing list >> archives (http://www.mail-archive.com/docbook-apps@lists.oasis-open.org/msg12243.html >> ) which describes a way to extend the pagesetup.xsl template with a >> static content region. >> >> After some tweaks, I actually managed to incorporate the example >> into my customization layer. However, I need to find a way to >> calculate an offset value for the top position of the fo-block that >> contains the language name. Whenever the language name changes, the >> offset should increase (and the fo block moves down). Right now, >> those fo-block containers always have the same position. >> >> My idea was to get the position of the parent element in the xml >> tree (the article element) and calculate the offset based on that. >> But I must be doing something wrong. Here is what I have come up >> with so far. >> >> 1) Changed the pagesetup.xsl template: >> <xsl:template match="*" mode="running.head.mode"> >> <xsl:param name="master-reference" select="'unknown'"/> >> <xsl:param name="gentext-key" select="local-name(.)"/> >> >> <!-- remove -draft from reference --> >> <xsl:variable name="pageclass"> >> <xsl:choose> >> <xsl:when test="contains($master-reference, '-draft')"> >> <xsl:value-of select="substring-before($master-reference,'- >> draft')"/> >> </xsl:when> >> <xsl:otherwise> >> <xsl:value-of select="$master-reference"/> >> </xsl:otherwise> >> </xsl:choose> >> </xsl:variable> >> <fo:static-content flow-name="xsl-region-before-blank"> >> <fo:block xsl:use-attribute-sets="header.content.properties"> >> <xsl:call-template name="header.table"> >> <xsl:with-param name="pageclass" select="$pageclass"/> >> <xsl:with-param name="sequence" select="'blank'"/> >> <xsl:with-param name="gentext-key" select="$gentext-key"/> >> </xsl:call-template> >> </fo:block> >> >> <!-- Sidebar output: --> >> <xsl:call-template name="article.language.bar"/> >> >> </fo:static-content> >> [...] >> </xsl:template> >> >> 2) Template for the sidebar >> >> <xsl:template name="article.language.bar"> >> >> <!-- calculate the top offset --> >> <xsl:call-template name="parent.position"> >> <xsl:with-param name="node" select="ancestor-or-self::article" /> >> </xsl:call-template> >> >> <fo:block-container >> text-align="center" >> reference-orientation="90" >> left="8in" >> absolute-position="fixed" >> height="0.25in" >> width="1.25in" >> top="0.5in" <--- This value should be calculated with the offset >> z-index="1" > >> <fo:block padding="0.05in" background-color="#ddd" font- >> size="1em" color="white" font-weight="bold"> >> <xsl:apply-templates select="." mode="titleabbrev.markup" /> >> </fo:block> >> </fo:block-container> >> </xsl:template> >> >> 3) Template for calculating the position of the article element >> >> <xsl:template name="parent.position"> >> <xsl:param name="node" /> >> <xsl:param name="position" select="position()" /> >> <xsl:message>Position is: <xsl:value-of select="$position" /></ >> xsl:message> >> </xsl:template> >> >> But, the position is always 1. Is the basic idea of calculating the >> offset value for the top position with help of the parent element >> position feasible or is there an easier way? >> >> Kind regards, >> /frank >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org >> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org > For additional commands, e-mail: docbook-apps-help@lists.oasis- > open.org > >
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]