fo-patch-for-fop.xsl 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?xml version="1.0"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:fo="http://www.w3.org/1999/XSL/Format"
  4. xmlns:fox="http://xml.apache.org/fop/extensions"
  5. version="1.0">
  6. <!-- ********************************************************************
  7. $Id$
  8. ********************************************************************
  9. This file is part of the DocBook XSL Stylesheet distribution.
  10. See ../README or http://docbook.sf.net/ for copyright
  11. and other information.
  12. ******************************************************************** -->
  13. <xsl:output method="xml"/>
  14. <xsl:template match="*">
  15. <xsl:element name="{name(.)}">
  16. <xsl:copy-of select="@*"/>
  17. <xsl:apply-templates/>
  18. </xsl:element>
  19. </xsl:template>
  20. <xsl:template match="fo:page-sequence
  21. |fo:single-page-master-reference
  22. |fo:repeatable-page-master-reference
  23. |fo:conditional-page-master-reference">
  24. <xsl:element name="{name(.)}">
  25. <xsl:for-each select="@*">
  26. <xsl:choose>
  27. <xsl:when test="name(.) = 'master-reference'">
  28. <xsl:attribute name="master-name">
  29. <xsl:value-of select="."/>
  30. </xsl:attribute>
  31. </xsl:when>
  32. <xsl:otherwise>
  33. <xsl:attribute name="{name(.)}">
  34. <xsl:value-of select="."/>
  35. </xsl:attribute>
  36. </xsl:otherwise>
  37. </xsl:choose>
  38. </xsl:for-each>
  39. <xsl:apply-templates/>
  40. </xsl:element>
  41. </xsl:template>
  42. <!-- a clever idea that doesn't quite work. fop 0.20.1 doesn't understand % -->
  43. <!-- and fop 0.20.2 doesn't work for me at all... -->
  44. <xsl:template match="fo:table-column">
  45. <xsl:element name="{name(.)}">
  46. <xsl:if test="not(@column-width)">
  47. <xsl:attribute name="column-width">
  48. <xsl:value-of select="100 div count(../fo:table-column)"/>
  49. <xsl:text>%</xsl:text>
  50. </xsl:attribute>
  51. </xsl:if>
  52. <xsl:copy-of select="@*"/>
  53. <xsl:apply-templates/>
  54. </xsl:element>
  55. </xsl:template>
  56. </xsl:stylesheet>