Advertisement
Guest User

test.xsl

a guest
May 11th, 2016
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--<xsl:stylesheet version="2.0"
  3. xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://saxon.sf.net/">-->
  4. <!-- xmlns:xs="http://www.w3.org/2001/XMLSchema"
  5. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  6. -->
  7. <xsl:stylesheet xmlns:xs="http://www.w3.org/1999/XSL/Transform"
  8. xmlns:saxon="http://saxon.sf.net/"
  9. exclude-result-prefixes="xs"
  10. version="2.0"
  11. xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  12. <xsl:template match="/">
  13. <html>
  14. <head>
  15. <h2>Report for Dr Zoidberg</h2>
  16. <div><xsl:value-of select="current-date()"/></div>
  17. <div><xsl:apply-templates select="/report/date"></xsl:apply-templates></div>
  18. </head>
  19. <body>
  20. <h2>Table of Contents</h2>
  21. <ul><xsl:apply-templates select="//analysis" mode="toc"/></ul>
  22.  
  23. <h2>Analysis</h2>
  24. <ul><xsl:apply-templates select="//analysis" mode="analysis"/></ul>
  25. <!-- <xsl:apply-templates select="/report/analysis/method"/>-->
  26.  
  27. <h2>Citations</h2>
  28. <ul><xsl:apply-templates select="//method" mode="cite"></xsl:apply-templates></ul>
  29.  
  30. </body>
  31. </html>
  32. </xsl:template>
  33.  
  34. <!-- list analysis -->
  35. <xsl:template match="analysis" mode="analysis">
  36. <li id="{@id}">
  37. <xsl:apply-templates select="@id"/>
  38. <ul><xsl:apply-templates select="/analysis/method"></xsl:apply-templates>
  39. <xsl:apply-templates select="method"/>
  40. </ul>
  41. </li>
  42. </xsl:template>
  43. <!-- list methods -->
  44. <xsl:template match="method">
  45. <li>
  46. <xsl:apply-templates select="@id"/>
  47. <!--citation-->
  48. <xsl:if test="document('contentconfig.xml')/cfg/analysis/method[@id=current()/@id]/citation">
  49. <sup>
  50. <a href="#cite{count(preceding::citation) + 1}">
  51. <xsl:value-of select="count(preceding::citation) + 1"/>
  52. </a>
  53. </sup>
  54. </xsl:if>
  55. </li>
  56. </xsl:template>
  57.  
  58. <!--TOC based on analysis -->
  59. <xsl:template match="analysis" mode="toc">
  60. <li>
  61. <a href="#{@id}">
  62. <xsl:apply-templates select="@id"/>
  63. </a>
  64. </li>
  65. </xsl:template>
  66.  
  67. <!--Citations -->
  68. <xsl:template match="method" mode="cite">
  69.  
  70. <xsl:if test="document('contentconfig.xml')/cfg/analysis/method[@id=current()/@id]/citation">
  71. <li>
  72. <cite id="cite{count(preceding::citation) + 1}">
  73. [<xsl:value-of select="count(preceding::citation) + 1"/>]
  74. <!--<cite id="cite{count(//Analysis) + 1}">
  75. [<xsl:value-of select="count(preceding::citation) + 1"/>]-->
  76.  
  77. <!-- get method::citation bidirectional -->
  78. <xsl:apply-templates select="sup/a/@id"/>
  79. <!-- <a href="#"-->
  80. <xsl:apply-templates select="document('contentconfig.xml')/cfg/analysis/method[@id=current()/@id]/citation"/>
  81. </cite>
  82. </li>
  83. </xsl:if>
  84.  
  85. </xsl:template>
  86.  
  87. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement