Hi,
please find below extended version of functions which adds support for
{odd|even}-{chapter|document}-title pseudo-variables for
headers/footers. In many document with double-sided output different
content has to be used on odd and even pages.
Also it would be nice if there is an easy way for specifying different
column widths separately for table used on odd and even pages for
header/footer. In many documents title are so long that they occupy
almost full width, but they are switching between left and right table
column for even/odd pages.
Jirka
<xsl:function name="u:expandHeaderOrFooter" as="item()*">
<xsl:param name="imageSpec" as="xs:string"/>
<xsl:param name="textSpec" as="xs:string"/>
<xsl:param name="pageNumber" as="item()*"/>
<xsl:param name="isEven" as="xs:boolean"/>
<xsl:param name="pageCount" as="item()*"/>
<xsl:param name="chapterTitle" as="item()*"/>
<xsl:param name="documentTitle" as="item()*"/>
<xsl:variable name="oddPageNumber"
select="if ($two-sided = 'yes' and $isEven)
then ()
else $pageNumber"/>
<xsl:variable name="evenPageNumber"
select="if ($two-sided = 'yes' and $isEven)
then $pageNumber
else ()"/>
<xsl:variable name="oddChapterTitle"
select="if ($two-sided = 'yes' and $isEven)
then ()
else $chapterTitle"/>
<xsl:variable name="evenChapterTitle"
select="if ($two-sided = 'yes' and $isEven)
then $chapterTitle
else ()"/>
<xsl:variable name="oddDocumentTitle"
select="if ($two-sided = 'yes' and $isEven)
then ()
else $documentTitle"/>
<xsl:variable name="evenDocumentTitle"
select="if ($two-sided = 'yes' and $isEven)
then $documentTitle
else ()"/>
<xsl:choose>
<xsl:when test="$imageSpec != ''">
<xsl:variable name="imageURI"
select="resolve-uri($imageSpec,
URI:userDirectory())"/>
<fo:external-graphic src="{concat('url(', $imageURI, ')')}"/>
</xsl:when>
<xsl:when test="$textSpec != ''">
<xsl:variable name="textSpec2">
<xsl:choose>
<xsl:when test="contains($textSpec, '^') and
not(contains($textSpec, '%'))">
<!-- Support ^page-number^ rather than %page-number%. -->
<xsl:value-of
select="translate(replace($textSpec, '\^\^', ''),
'^', '%')" />
</xsl:when>
<xsl:otherwise>
<!--  belongs to Unicode Basic Multilingual Plane
Private Use Area: U+E000 to U+F8FF -->
<xsl:value-of select="replace($textSpec, '%%', '')" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:sequence
select="for $t in tokenize($textSpec2, '%')
return
if ($t = 'page-number') then $pageNumber
else
if ($t = 'odd-page-number') then $oddPageNumber
else
if ($t = 'even-page-number') then $evenPageNumber
else
if ($t = 'page-count') then $pageCount
else
if ($t = 'chapter-title') then $chapterTitle
else
if ($t = 'odd-chapter-title') then
$oddChapterTitle
else
if ($t = 'even-chapter-title') then
$evenChapterTitle
else
if ($t = 'document-title') then
$documentTitle
else
if ($t = 'odd-document-title') then
$oddDocumentTitle
else
if ($t = 'even-document-title')
then $evenDocumentTitle
else
if ($t != '')
then replace(replace($t,
'', '^'),
'', '%')
else ()"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>
--
------------------------------------------------------------------
Jirka Kosek e-mail: [email protected] http://xmlguru.cz
------------------------------------------------------------------
Professional XML consulting and training services
DocBook customization, custom XSLT/XSL-FO document processing
------------------------------------------------------------------
OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
------------------------------------------------------------------
signature.asc
Description: OpenPGP digital signature
-- XMLmind DITA Converter Support List [email protected] http://www.xmlmind.com/mailman/listinfo/ditac-support

