Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

addPtr.xsl 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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:foi="http://xmlgraphics.apache.org/fop/internal">
  21. <xsl:template name="addPtr">
  22. <xsl:copy>
  23. <xsl:apply-templates select="@*"/>
  24. <xsl:attribute name="foi:ptr">
  25. <xsl:value-of select="generate-id()"/>
  26. </xsl:attribute>
  27. <xsl:apply-templates/>
  28. </xsl:copy>
  29. </xsl:template>
  30. <!-- Block-level Formatting Objects -->
  31. <xsl:template match="fo:block|fo:block-container">
  32. <xsl:call-template name="addPtr"/>
  33. </xsl:template>
  34. <!-- Inline-level Formatting Objects -->
  35. <xsl:template match="fo:character|fo:inline|fo:inline-container">
  36. <xsl:call-template name="addPtr"/>
  37. </xsl:template>
  38. <xsl:template match="fo:external-graphic|fo:instream-foreign-object">
  39. <xsl:call-template name="addPtr"/>
  40. </xsl:template>
  41. <xsl:template match="fo:page-number|fo:page-number-citation|fo:page-number-citation-last">
  42. <xsl:call-template name="addPtr"/>
  43. </xsl:template>
  44. <!-- Formatting Objects for Tables -->
  45. <xsl:template match="fo:table-and-caption|fo:table-caption|fo:table">
  46. <xsl:call-template name="addPtr"/>
  47. </xsl:template>
  48. <xsl:template match="fo:table-header|fo:table-footer|fo:table-body|fo:table-row|fo:table-cell">
  49. <xsl:call-template name="addPtr"/>
  50. </xsl:template>
  51. <!-- Formatting Objects for Lists -->
  52. <xsl:template match="fo:list-block|fo:list-item|fo:list-item-label|fo:list-item-body">
  53. <xsl:call-template name="addPtr"/>
  54. </xsl:template>
  55. <!-- Dynamic Effects: Link and Multi Formatting Objects -->
  56. <xsl:template match="fo:basic-link">
  57. <xsl:call-template name="addPtr"/>
  58. </xsl:template>
  59. <!-- Out-of-Line Formatting Objects -->
  60. <xsl:template match="fo:float|fo:footnote|fo:footnote-body">
  61. <xsl:call-template name="addPtr"/>
  62. </xsl:template>
  63. <!-- Other Formatting Objects -->
  64. <xsl:template match="fo:wrapper|fo:marker">
  65. <xsl:call-template name="addPtr"/>
  66. </xsl:template>
  67. <xsl:template match="@*|node()">
  68. <xsl:copy>
  69. <xsl:apply-templates select="@*|node()"/>
  70. </xsl:copy>
  71. </xsl:template>
  72. </xsl:stylesheet>