您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

block_white-space-collapse_1.xml 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. <testcase>
  18. <info>
  19. <p>
  20. This test checks basic white space handling for white-space-collapse="true".
  21. </p>
  22. </info>
  23. <fo>
  24. <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
  25. <fo:layout-master-set>
  26. <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
  27. <fo:region-body/>
  28. </fo:simple-page-master>
  29. </fo:layout-master-set>
  30. <fo:page-sequence master-reference="normal" white-space-collapse="true">
  31. <fo:flow flow-name="xsl-region-body">
  32. <fo:block background-color="silver" margin="1pt 0pt 1pt 0pt">
  33. spaces
  34. before
  35. and
  36. after
  37. each
  38. word <fo:character character="&#xa;" />
  39. <fo:character character=" " /><fo:character character=" " /> and
  40. linefeeds<fo:character character=" " /><fo:character character=" " />
  41. everywhere <fo:character character=" " />
  42. </fo:block>
  43. <fo:block background-color="silver" margin="1pt 0pt 1pt 0pt">
  44. <fo:block background-color="orange">
  45. nested block level
  46. </fo:block>
  47. <fo:block background-color="red">
  48. nested block level
  49. </fo:block>
  50. </fo:block>
  51. <fo:block background-color="silver" margin="1pt 0pt 1pt 0pt">
  52. <fo:inline background-color="orange">
  53. inline level
  54. </fo:inline>
  55. <fo:inline background-color="red">
  56. inline level
  57. </fo:inline>
  58. </fo:block>
  59. <fo:block background-color="silver" margin="1pt 0pt 1pt 0pt">
  60. block level
  61. <fo:inline background-color="orange">
  62. inline level
  63. </fo:inline>
  64. block
  65. <fo:inline background-color="red">
  66. inline level
  67. </fo:inline>
  68. block level
  69. </fo:block>
  70. <fo:block background-color="silver" margin="1pt 0pt 1pt 0pt">
  71. <fo:inline background-color="orange">
  72. inline level
  73. <fo:inline background-color="red">
  74. nested inline level
  75. </fo:inline>
  76. </fo:inline>
  77. </fo:block>
  78. <fo:block background-color="silver" margin="1pt 0pt 1pt 0pt">
  79. <fo:inline background-color="orange">
  80. <fo:inline background-color="red">
  81. nested inline level
  82. </fo:inline>
  83. inline level
  84. </fo:inline>
  85. </fo:block>
  86. <fo:block background-color="silver" margin="1pt 0pt 1pt 0pt">
  87. block level
  88. <fo:inline background-color="orange">
  89. <fo:inline background-color="red">
  90. nested inline level
  91. </fo:inline>
  92. inline level
  93. </fo:inline>
  94. block level
  95. </fo:block>
  96. </fo:flow>
  97. </fo:page-sequence>
  98. </fo:root>
  99. </fo>
  100. <checks>
  101. <eval expected="6" xpath="count(//flow/block[1]/lineArea[1]/text[1]/word)"/>
  102. <eval expected="6" xpath="count(//flow/block[1]/lineArea[1]/text[1]/space)"/>
  103. <eval expected="2" xpath="count(//flow/block[1]/lineArea[1]/text[2]/word)"/>
  104. <eval expected="1" xpath="count(//flow/block[1]/lineArea[1]/text[2]/space)"/>
  105. <eval expected="1" xpath="count(//flow/block[1]/lineArea[1]/text[3]/space)"/>
  106. <eval expected="1" xpath="count(//flow/block[1]/lineArea[1]/text[4]/word)"/>
  107. <eval expected="3" xpath="count(//flow/block[2]/block[1]/lineArea[1]/text/word)"/>
  108. <eval expected="2" xpath="count(//flow/block[2]/block[1]/lineArea[1]/text/space)"/>
  109. <eval expected="3" xpath="count(//flow/block[2]/block[2]/lineArea[1]/text/word)"/>
  110. <eval expected="2" xpath="count(//flow/block[2]/block[2]/lineArea[1]/text/space)"/>
  111. <eval expected="2" xpath="count(//flow/block[3]/lineArea[1]/inlineparent[1]/text/word)"/>
  112. <eval expected="2" xpath="count(//flow/block[3]/lineArea[1]/inlineparent[1]/text/space)"/>
  113. <eval expected="1" xpath="count(//flow/block[3]/lineArea[1]/text[1]/space)"/>
  114. <eval expected="2" xpath="count(//flow/block[3]/lineArea[1]/inlineparent[2]/text/word)"/>
  115. <eval expected="2" xpath="count(//flow/block[3]/lineArea[1]/inlineparent[2]/text/space)"/>
  116. <eval expected="2" xpath="count(//flow/block[4]/lineArea[1]/text[1]/word)"/>
  117. <eval expected="2" xpath="count(//flow/block[4]/lineArea[1]/text[1]/space)"/>
  118. <eval expected="2" xpath="count(//flow/block[4]/lineArea[1]/inlineparent[1]/text/word)"/>
  119. <eval expected="3" xpath="count(//flow/block[4]/lineArea[1]/inlineparent[1]/text/space)"/>
  120. <eval expected="1" xpath="count(//flow/block[4]/lineArea[1]/text[2]/word)"/>
  121. <eval expected="2" xpath="count(//flow/block[4]/lineArea[1]/text[2]/space)"/>
  122. <eval expected="2" xpath="count(//flow/block[4]/lineArea[1]/inlineparent[2]/text/word)"/>
  123. <eval expected="3" xpath="count(//flow/block[4]/lineArea[1]/inlineparent[2]/text/space)"/>
  124. <eval expected="2" xpath="count(//flow/block[4]/lineArea[1]/text[3]/word)"/>
  125. <eval expected="2" xpath="count(//flow/block[4]/lineArea[1]/text[3]/space)"/>
  126. <eval expected="2" xpath="count(//flow/block[5]/lineArea[1]/inlineparent[1]/text/word)"/>
  127. <eval expected="2" xpath="count(//flow/block[5]/lineArea[1]/inlineparent[1]/text/space)"/>
  128. <eval expected="3" xpath="count(//flow/block[5]/lineArea[1]/inlineparent[1]/inlineparent[1]/text/word)"/>
  129. <eval expected="3" xpath="count(//flow/block[5]/lineArea[1]/inlineparent[1]/inlineparent[1]/text/space)"/>
  130. <eval expected="3" xpath="count(//flow/block[6]/lineArea[1]/inlineparent[1]/inlineparent[1]/text/word)"/>
  131. <eval expected="3" xpath="count(//flow/block[6]/lineArea[1]/inlineparent[1]/inlineparent[1]/text/space)"/>
  132. <eval expected="2" xpath="count(//flow/block[6]/lineArea[1]/inlineparent[1]/text/word)"/>
  133. <eval expected="2" xpath="count(//flow/block[6]/lineArea[1]/inlineparent[1]/text/space)"/>
  134. <eval expected="2" xpath="count(//flow/block[7]/lineArea[1]/text[1]/word)"/>
  135. <eval expected="2" xpath="count(//flow/block[7]/lineArea[1]/text[1]/space)"/>
  136. <eval expected="1" xpath="count(//flow/block[7]/lineArea[1]/inlineparent[1]/text[1]/space)"/>
  137. <eval expected="3" xpath="count(//flow/block[7]/lineArea[1]/inlineparent[1]/inlineparent[1]/text/word)"/>
  138. <eval expected="4" xpath="count(//flow/block[7]/lineArea[1]/inlineparent[1]/inlineparent[1]/text/space)"/>
  139. <eval expected="2" xpath="count(//flow/block[7]/lineArea[1]/inlineparent[1]/text[2]/word)"/>
  140. <eval expected="3" xpath="count(//flow/block[7]/lineArea[1]/inlineparent[1]/text[2]/space)"/>
  141. <eval expected="2" xpath="count(//flow/block[7]/lineArea[1]/text[2]/word)"/>
  142. <eval expected="2" xpath="count(//flow/block[7]/lineArea[1]/text[2]/space)"/>
  143. </checks>
  144. </testcase>