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.

extract-events.xsl 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet version="1.0"
  3. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  4. xmlns:fo="http://www.w3.org/1999/XSL/Format"
  5. exclude-result-prefixes="fo">
  6. <xsl:output indent="yes" omit-xml-declaration="yes"/>
  7. <xsl:template match="fo:root">
  8. <event>
  9. <xsl:text>start root</xsl:text>
  10. </event>
  11. <xsl:apply-templates select="fo:page-sequence"/>
  12. <event>
  13. <xsl:text>end root</xsl:text>
  14. </event>
  15. </xsl:template>
  16. <xsl:template match="fo:*">
  17. <xsl:call-template name="process.node">
  18. <xsl:with-param name="id">
  19. <xsl:apply-templates select="@id"/>
  20. </xsl:with-param>
  21. </xsl:call-template>
  22. </xsl:template>
  23. <!-- Those elements do not retrieve the id property.
  24. This will have to be fixed at some point. -->
  25. <xsl:template match="fo:footnote|fo:footnote-body">
  26. <xsl:call-template name="process.node"/>
  27. </xsl:template>
  28. <xsl:template name="process.node">
  29. <xsl:param name="id" select="''"/>
  30. <event>
  31. <xsl:text>start </xsl:text>
  32. <xsl:value-of select="local-name()"/>
  33. <xsl:value-of select="$id"/>
  34. </event>
  35. <xsl:apply-templates/>
  36. <event>
  37. <xsl:text>end </xsl:text>
  38. <xsl:value-of select="local-name()"/>
  39. <xsl:value-of select="$id"/>
  40. </event>
  41. </xsl:template>
  42. <xsl:template match="@id">
  43. <xsl:text> id="</xsl:text>
  44. <xsl:value-of select="."/>
  45. <xsl:text>"</xsl:text>
  46. </xsl:template>
  47. <xsl:template match="text()"/>
  48. </xsl:stylesheet>