You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fop-poster.xsl 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one or more
  4. contributor license agreements. See the NOTICE file distributed with
  5. this work for additional information regarding copyright ownership.
  6. The ASF licenses this file to You under the Apache License, Version 2.0
  7. (the "License"); you may not use this file except in compliance with
  8. the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. -->
  16. <!-- $Id$ -->
  17. <xsl:stylesheet version="1.0"
  18. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  19. xmlns:fo="http://www.w3.org/1999/XSL/Format"
  20. xmlns:svg="http://www.w3.org/2000/svg"
  21. xmlns:exslt="http://exslt.org/common"
  22. xmlns:xlink="http://www.w3.org/1999/xlink"
  23. extension-element-prefixes="exslt">
  24. <xsl:output method="xml" indent="yes"/>
  25. <xsl:include href="poster.xsl"/>
  26. <xsl:include href="common.xsl"/>
  27. <xsl:template match="poster">
  28. <fo:root font-family="Verdana" font-size="14pt">
  29. <xsl:call-template name="poster-layout-master-set"/>
  30. <fo:declarations>
  31. <x:xmpmeta xmlns:x="adobe:ns:meta/">
  32. <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  33. <rdf:Description rdf:about="" xmlns:xap="http://ns.adobe.com/xap/1.0">
  34. <xap:Title>
  35. <rdf:Alt>
  36. <rdf:li xml:lang="x-default">Apache FOP Poster</rdf:li>
  37. <rdf:li xml:lang="de">Apache FOP Plakat</rdf:li>
  38. </rdf:Alt>
  39. </xap:Title>
  40. </rdf:Description>
  41. <rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">
  42. <dc:creator>Jeremias Märki</dc:creator>
  43. <dc:title>
  44. <rdf:Alt>
  45. <rdf:li xml:lang="x-default">Apache FOP Poster</rdf:li>
  46. <rdf:li xml:lang="de">Apache FOP Plakat</rdf:li>
  47. </rdf:Alt>
  48. </dc:title>
  49. </rdf:Description>
  50. </rdf:RDF>
  51. </x:xmpmeta>
  52. </fo:declarations>
  53. <fo:page-sequence master-reference="A2plusL" language="en" hyphenate="true" text-align="justify">
  54. <fo:static-content flow-name="xsl-region-before">
  55. <xsl:call-template name="background"/>
  56. </fo:static-content>
  57. <fo:flow flow-name="xsl-region-body">
  58. <xsl:apply-templates select="section"/>
  59. </fo:flow>
  60. </fo:page-sequence>
  61. </fo:root>
  62. </xsl:template>
  63. <xsl:template name="background">
  64. <fo:block-container absolute-position="fixed" width="700mm" height="500mm">
  65. <fo:block line-height="0">
  66. <fo:instream-foreign-object>
  67. <svg xmlns="http://www.w3.org/2000/svg" width="700mm"
  68. height="500mm" viewBox="0 0 840 594">
  69. <g font-family="Verdana">
  70. <path
  71. d="M 0,55 L 580,55 c 40,0 60,30 100,30 L 840,85 840,575 L 280,575 c -40,0 -60,-50, -100,-50 L 0,525 z"
  72. style="fill:lightblue; stroke:none;" />
  73. <path
  74. d="M 0,55 L 580,55 c 40,0 60,30 100,30 L 840,85"
  75. style="fill:none; stroke:blue; stroke-width:5;" />
  76. <path
  77. d="M 840,575 L 280,575 c -40,0 -60,-50 -100,-50 L 0,525"
  78. style="fill:none; stroke:blue; stroke-width:5;" />
  79. <image x="680" y="7" width="140" height="60" xlink:href="../svg/fop-logo-reconstructed.svg"/>
  80. <text x="15" y="35" style="fill:black; font-weight:bold; font-size:17">
  81. Apache FOP - The leading open source XSL-FO formatter
  82. </text>
  83. <text x="685" y="74" style="fill:black; font-size:5.5">
  84. A product of the Apache XML Graphics Project
  85. </text>
  86. <image x="15" y="530" width="160" height="60" xlink:href="../svg/asf-logo.svg"/>
  87. <text x="360" y="560" style="fill:blue; font-size:12">
  88. For more details, please visit: <a xlink:href="http://xmlgraphics.apache.org/fop/">http://xmlgraphics.apache.org/fop/</a>
  89. </text>
  90. <text style="fill:gray; font-size:5" text-anchor="end">
  91. <tspan x="830" y="587">
  92. Poster generated with Apache FOP and Apache Batik
  93. </tspan>
  94. <tspan x="830" y="594">
  95. The sources for the poster are available under: <a xlink:href="http://svn.apache.org/repos/asf/xmlgraphics/fop/trunk/src/documentation/poster">http://svn.apache.org/repos/asf/xmlgraphics/fop/trunk/src/documentation/poster</a>
  96. </tspan>
  97. </text>
  98. </g>
  99. </svg>
  100. </fo:instream-foreign-object>
  101. </fo:block>
  102. </fo:block-container>
  103. </xsl:template>
  104. <xsl:template match="section">
  105. <xsl:variable name="section-content" select="exslt:node-set(document(@href, .))"/>
  106. <fo:block
  107. space-before.minimum="2mm" space-before.optimum="5mm" space-before.maximum="30mm"
  108. space-before.conditionality="discard" space-after.conditionality="discard"
  109. space-after.minimum="2mm" space-after.optimum="5mm" space-after.maximum="30mm"
  110. keep-together.within-column="always">
  111. <fo:block-container width="{@width}mm" height="{@height}mm" space-after="-{@height}mm">
  112. <fo:block line-height="0">
  113. <fo:instream-foreign-object overflow="visible">
  114. <xsl:call-template name="section-box">
  115. <xsl:with-param name="width" select="@width"/>
  116. <xsl:with-param name="height" select="@height"/>
  117. <xsl:with-param name="tab-width" select="$section-content/section/title/@tab-width"/>
  118. <xsl:with-param name="title" select="$section-content/section/title"/>
  119. </xsl:call-template>
  120. </fo:instream-foreign-object>
  121. </fo:block>
  122. </fo:block-container>
  123. <fo:block-container width="{@width}mm - 8mm" height="{@height}mm - 24mm"
  124. padding="4mm" padding-top="16mm" padding-bottom="8mm" margin="0pt"
  125. display-align="distribute" id="section{position()}">
  126. <fo:block>
  127. <xsl:apply-templates select="$section-content/section/*[local-name() != 'title']"/>
  128. </fo:block>
  129. </fo:block-container>
  130. </fo:block>
  131. </xsl:template>
  132. <xsl:template name="section-box">
  133. <xsl:param name="width" select="200"/>
  134. <xsl:param name="height" select="100"/>
  135. <xsl:param name="tab-width" select="35"/>
  136. <xsl:param name="title" select="'Title'"/>
  137. <xsl:variable name="stroke-width" select="2"/>
  138. <xsl:variable name="offset" select="$stroke-width div 2"/>
  139. <xsl:variable name="w" select="$width - $stroke-width"/>
  140. <xsl:variable name="h" select="$height - $stroke-width"/>
  141. <svg xmlns="http://www.w3.org/2000/svg" width="{$width}mm" height="{$height}mm" viewBox="0 0 {$width} {$height}">
  142. <g transform="translate({$offset},{$offset})" font-family="Verdana">
  143. <path d="M 0,5 S 0,0 5,0 L {$tab-width},0 C {$tab-width + 10},0 {$tab-width + 10},10 {$tab-width + 20},10 L {$w - 5},10 S {$w},10 {$w},15 L {$w},{$h - 5} S {$w},{$h}, {$w - 5},{$h} L 5,{$h} S 0,{$h} 0,{$h - 5} z"
  144. style="fill:rgb(240,240,255); stroke:blue; stroke-width:{$stroke-width};" />
  145. <text x="4" y="9" style="fill:blue; font-size:7">
  146. <xsl:value-of select="$title"/>
  147. </text>
  148. </g>
  149. </svg>
  150. </xsl:template>
  151. </xsl:stylesheet>