File: fo-patch-for-fop.xsl

package info (click to toggle)
phpdoc 20050512-1
  • links: PTS
  • area: non-free
  • in suites: sarge
  • size: 36,592 kB
  • ctags: 1,501
  • sloc: xml: 376,768; php: 6,708; cpp: 500; makefile: 293; perl: 161; sh: 151; awk: 28
file content (64 lines) | stat: -rw-r--r-- 2,150 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:fo="http://www.w3.org/1999/XSL/Format"
                xmlns:fox="http://xml.apache.org/fop/extensions"
                version="1.0">

<!-- ********************************************************************
     $Id: fo-patch-for-fop.xsl,v 1.3 2004/10/01 16:32:07 techtonik Exp $
     ********************************************************************

     This file is part of the DocBook XSL Stylesheet distribution.
     See ../README or http://docbook.sf.net/ for copyright
     and other information.

     ******************************************************************** -->

<xsl:output method="xml"/>

<xsl:template match="*">
  <xsl:element name="{name(.)}">
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
  </xsl:element>
</xsl:template>

<xsl:template match="fo:page-sequence
                     |fo:single-page-master-reference
                     |fo:repeatable-page-master-reference
                     |fo:conditional-page-master-reference">
  <xsl:element name="{name(.)}">
    <xsl:for-each select="@*">
      <xsl:choose>
        <xsl:when test="name(.) = 'master-reference'">
          <xsl:attribute name="master-name">
            <xsl:value-of select="."/>
          </xsl:attribute>
        </xsl:when>
        <xsl:otherwise>
          <xsl:attribute name="{name(.)}">
            <xsl:value-of select="."/>
          </xsl:attribute>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:for-each>
    <xsl:apply-templates/>
  </xsl:element>
</xsl:template>

<!-- a clever idea that doesn't quite work. fop 0.20.1 doesn't understand % -->
<!-- and fop 0.20.2 doesn't work for me at all... -->
<xsl:template match="fo:table-column">
  <xsl:element name="{name(.)}">
    <xsl:if test="not(@column-width)">
      <xsl:attribute name="column-width">
        <xsl:value-of select="100 div count(../fo:table-column)"/>
        <xsl:text>%</xsl:text>
      </xsl:attribute>
    </xsl:if>
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
  </xsl:element>
</xsl:template>

</xsl:stylesheet>