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 6.7KB

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