File: fo-patch-for-fop.xsl

package info (click to toggle)
php-doc 20061001-1
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 45,764 kB
  • ctags: 1,611
  • sloc: xml: 502,485; php: 7,645; cpp: 500; makefile: 297; perl: 161; sh: 141; 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.4 2005/07/15 08:27:48 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>