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.

xml2ascii.xsl 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?xml version="1.0"?>
  2. <!-- XSLT stylesheet: QAML -> No Markup (QAML = FAQ Markup Language)
  3. author: F. Jannidis <jannidis@.lrz.uni-muenchen.de>
  4. version: 1.00ß
  5. -->
  6. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  7. <xsl:output method="text"/>
  8. <xsl:template match ="/">
  9. <xsl:apply-templates/>
  10. </xsl:template>
  11. <!-- writes the header of the html file with a link to css stylesheet-->
  12. <xsl:template match ="head">
  13. <xsl:apply-templates/>
  14. </xsl:template>
  15. <!-- don't output maintain and version-->
  16. <xsl:template match ="maintain">
  17. </xsl:template>
  18. <xsl:template match ="version">
  19. </xsl:template>
  20. <!-- header title -->
  21. <xsl:template match ="head/title">
  22. <xsl:apply-templates/>
  23. </xsl:template>
  24. <!-- body -->
  25. <xsl:template match ="body">
  26. <!-- generates table of contents with links to the different levels-->
  27. <xsl:for-each select="section[@class='level1']/title">
  28. <xsl:text>&#10;</xsl:text><xsl:number value="position()"/>) <xsl:value-of select="."/>
  29. </xsl:for-each>
  30. <!-- processing of the rest -->
  31. <xsl:apply-templates/>
  32. <!-- writes the footer -->
  33. Version: <xsl:value-of select="/faq/head/version"/> -
  34. Contact: <xsl:value-of select="//head/maintain/name"/> (<xsl:value-of select="//head/maintain/email"/>)
  35. </xsl:template>
  36. <!-- title level1, numbering is generated -->
  37. <xsl:template match ="section[@class='level1']/title">
  38. <xsl:number count="section[@class='level1']"/>) <xsl:apply-templates/>
  39. </xsl:template>
  40. <!-- title level2 -->
  41. <xsl:template match ="section[@class='level2']/title">
  42. <xsl:apply-templates/>
  43. </xsl:template>
  44. <!-- title level3 -->
  45. <xsl:template match ="section[@class='level3']/title">
  46. <xsl:apply-templates/>
  47. </xsl:template>
  48. <!-- question -->
  49. <xsl:template match ="q">
  50. <xsl:apply-templates/>
  51. </xsl:template>
  52. <!-- answer -->
  53. <xsl:template match ="a">
  54. <xsl:apply-templates/>
  55. </xsl:template>
  56. <!-- para -->
  57. <xsl:template match ="p">
  58. <xsl:apply-templates/>
  59. </xsl:template>
  60. <!-- test span -->
  61. <xsl:template match ="span">
  62. <xsl:apply-templates/>
  63. </xsl:template>
  64. <!-- links -->
  65. <xsl:template match ="link">
  66. <xsl:apply-templates/> (<xsl:value-of select="@href"/>)
  67. </xsl:template>
  68. </xsl:stylesheet>