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.

inhprop.fo 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- example for a simple fo file. At the beginning the page layout is set.
  3. Below fo:root there is always
  4. - a single fo:layout-master-set which defines one or more page layouts
  5. - an optional fo:declarations,
  6. - and a sequence of one or more fo:page-sequences containing the text and formatting instructions -->
  7. <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  8. <fo:layout-master-set>
  9. <!-- fo:layout-master-set defines in its children the page layout:
  10. the pagination and layout specifications
  11. - page-masters: have the role of describing the intended subdivisions
  12. of a page and the geometry of these subdivisions
  13. - page-sequence-masters: have the role of describing the sequence
  14. of page-masters that will be used to generate
  15. pages during the formatting of an fo:page-sequence
  16. -->
  17. <!-- layout for the first page -->
  18. <fo:simple-page-master master-name="first"
  19. page-height="29.7cm"
  20. page-width="21cm"
  21. margin-top="1cm"
  22. margin-bottom="2cm"
  23. margin-left="2.0cm + 0.5cm"
  24. margin-right="(5cm * 1cm) div 2cm">
  25. <fo:region-body margin-top="3cm"/>
  26. <fo:region-before extent="3cm"/>
  27. <fo:region-after extent="1.5cm"/>
  28. </fo:simple-page-master>
  29. <!-- layout for the other pages -->
  30. <fo:simple-page-master master-name="rest"
  31. page-height="abs(-30cm + .3cm)"
  32. page-width="(10cm * 2) + 1cm"
  33. margin-top="round(.5) * 1cm"
  34. margin-bottom="round(2.4) * 1cm"
  35. margin-left="2.5 * 1cm"
  36. margin-right="5.5cm - 3cm">
  37. <fo:region-body margin-top="2.5cm"/>
  38. <fo:region-before extent="2.5cm"/>
  39. <fo:region-after extent="1.5cm"/>
  40. </fo:simple-page-master>
  41. <fo:page-sequence-master master-name="basicPSM" >
  42. <fo:repeatable-page-master-alternatives>
  43. <fo:conditional-page-master-reference master-reference="first"
  44. page-position="first" />
  45. <fo:conditional-page-master-reference master-reference="rest"
  46. page-position="rest" />
  47. <!-- recommended fallback procedure -->
  48. <fo:conditional-page-master-reference master-reference="rest" />
  49. </fo:repeatable-page-master-alternatives>
  50. </fo:page-sequence-master>
  51. </fo:layout-master-set>
  52. <!-- end: defines page layout -->
  53. <!-- actual layout -->
  54. <fo:page-sequence master-reference="basicPSM">
  55. <!-- header -->
  56. <fo:static-content flow-name="xsl-region-before">
  57. <fo:block text-align="end"
  58. font-size="10pt"
  59. font-family="serif"
  60. line-height="1em + 4pt" >
  61. Property Function Tests - p. <fo:page-number/>
  62. </fo:block>
  63. </fo:static-content>
  64. <fo:flow flow-name="xsl-region-body">
  65. <!-- defines text title level 1-->
  66. <fo:block font-size="min(18pt,20pt)"
  67. font-family="sans-serif"
  68. line-height="max(24pt,18pt)"
  69. space-after.optimum="5 mod 3 * 7.5pt"
  70. background-color="rgb(0,0,255)"
  71. color="rgb(255,255,255)"
  72. text-align="center"
  73. padding-top="3pt">
  74. Property Function Tests
  75. </fo:block>
  76. <!-- defines text title level 2-->
  77. <fo:block font-size="floor(16.3) * 1pt"
  78. font-family="sans-serif"
  79. line-height="2pt * ceiling(9.3)"
  80. space-before.optimum="10pt"
  81. space-after.optimum="10pt"
  82. text-align="start"
  83. keep-with-next.within-page="always"
  84. keep-together.within-page="always"
  85. padding-top="3pt">
  86. Function: object from-parent( <fo:inline font-weight='bold'>NCName</fo:inline>)
  87. </fo:block>
  88. <!-- Normal text -->
  89. <fo:block font-size="12pt"
  90. font-family="sans-serif"
  91. line-height="1.25em"
  92. space-after="3pt"
  93. keep-together="auto"
  94. text-align="start">
  95. The from-parent function returns a computed value of the property
  96. whose name matches the argument specified. The value returned is that
  97. for the parent of the formatting object for which the expression is
  98. evaluated. If there is no parent, the value returned is the initial
  99. value. If the argument specifies a shorthand property and if the
  100. expression only consists of the from-parent function with an argument
  101. matching the property being computed, it is interpreted as an
  102. expansion of the shorthand with each property into which the shorthand
  103. expands, each having a value of from-parent with an argument matching
  104. the property. It is an error if arguments matching a shorthand
  105. property are used in any other way.
  106. <fo:block font-size="from-parent(font-size) - 2pt"
  107. font-family="sans-serif"
  108. space-before="from-parent(space-after)"
  109. text-align="center">
  110. Here is a nested block with font-size =
  111. from-parent(font-size) - 2pt.
  112. Since its parent has font-size=12pt, that should mean 10pt. It should
  113. keep the line height of 1.25em, which means 12.5pt leading. It's
  114. space-before value is set to the space-after value from its
  115. parent. Note that neither of these are inheritable. Does it look right?
  116. </fo:block>
  117. <fo:block font-size="from-parent(font-size) + 2pt"
  118. space-before="2pt"
  119. space-after="from-parent(space-after)"
  120. font-family="sans-serif"
  121. start-indent="from-parent(start-indent) + 1cm"
  122. end-indent="from-parent(end-indent) + 1cm"
  123. text-align="end"
  124. background-color="black" color="rgb(50%,50%,50%)">
  125. Here is a nested block with text 2pt larger than its parent (that
  126. should be 14pt). This parent is indented 1cm on both start and end
  127. directions with respect to the values from its parent (which aren't
  128. specified, so they default to 0.0). The color is set to 50% (using the
  129. rgb function with % arguements, and the background color for this
  130. block is black (specified as a keyword). In this block, we'll put an
  131. <fo:inline color='inherited-property-value(background-color)'
  132. background-color='inherited-property-value(color)'>inline object</fo:inline>
  133. whose background and foreground colors invert those of its containing
  134. block. This uses the <fo:inline
  135. font-style='oblique'>inherited-property-value</fo:inline>
  136. function. Here's an <fo:inline color='black' background-color='white'>inline
  137. object</fo:inline> with fixed colors (black on white). That doesn't
  138. work either. Guess it's not my problem... So let's try it with font
  139. sizes. In this block, we'll put an
  140. <fo:inline font-size='inherited-property-value(font-size)+2pt'>inline
  141. object whose font-size is 2 pt bigger than its parent's font-size.</fo:inline></fo:block>
  142. </fo:block>
  143. <fo:block font-size="12pt"
  144. space-before="6pt"
  145. line-height="1em + 2pt"
  146. font-family="sans-serif"
  147. text-align="start"
  148. background-color="rgb(50%,50%,50%)">
  149. An outer block with 12 pt text on 14 pt leading, default color
  150. and 50% grey background color. Test inherited color changes with
  151. nested blocks.
  152. <fo:block color='from-parent(background-color)'
  153. background-color='from-parent(color)'>
  154. Interchange color and background color using from-parent function.
  155. </fo:block>
  156. </fo:block>
  157. </fo:flow>
  158. </fo:page-sequence>
  159. </fo:root>