No Description
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.

ref.xsl 8.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!--
  3. Copyright (c) 1999 - 2017 XMPP Standards Foundation
  4. Permission is hereby granted, free of charge, to any person obtaining a copy
  5. of this software and associated documentation files (the "Software"), to deal
  6. in the Software without restriction, including without limitation the rights
  7. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. copies of the Software, and to permit persons to whom the Software is
  9. furnished to do so, subject to the following conditions:
  10. The above copyright notice and this permission notice shall be included in
  11. all copies or substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18. THE SOFTWARE.
  19. -->
  20. <!-- Author: stpeter
  21. Description: transforms XEP meta-data into IETF reference
  22. -->
  23. <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
  24. <xsl:output method='xml' indent='yes' version='1.0' encoding='UTF-8'/>
  25. <xsl:template match='/'>
  26. <reference>
  27. <xsl:attribute name='anchor'><xsl:text>XEP-</xsl:text><xsl:value-of select='/xep/header/number'/></xsl:attribute>
  28. <front>
  29. <title><xsl:value-of select='/xep/header/title' /></title>
  30. <xsl:apply-templates select='/xep/header/author'/>
  31. <xsl:variable name='fulldate' select='/xep/header/revision[position()=1]/date'/>
  32. <xsl:variable name='year' select='substring-before($fulldate,"-")'/>
  33. <xsl:variable name='monthday' select='substring-after($fulldate,"-")'/>
  34. <xsl:variable name='month' select='substring-before($monthday,"-")'/>
  35. <xsl:variable name='day' select='substring-after($monthday,"-")'/>
  36. <date>
  37. <xsl:attribute name='day'><xsl:value-of select='$day'/></xsl:attribute>
  38. <xsl:choose>
  39. <xsl:when test='$month = "01"'>
  40. <xsl:attribute name='month'><xsl:text>January</xsl:text></xsl:attribute>
  41. </xsl:when>
  42. <xsl:when test='$month = "02"'>
  43. <xsl:attribute name='month'><xsl:text>February</xsl:text></xsl:attribute>
  44. </xsl:when>
  45. <xsl:when test='$month = "03"'>
  46. <xsl:attribute name='month'><xsl:text>March</xsl:text></xsl:attribute>
  47. </xsl:when>
  48. <xsl:when test='$month = "04"'>
  49. <xsl:attribute name='month'><xsl:text>April</xsl:text></xsl:attribute>
  50. </xsl:when>
  51. <xsl:when test='$month = "05"'>
  52. <xsl:attribute name='month'><xsl:text>May</xsl:text></xsl:attribute>
  53. </xsl:when>
  54. <xsl:when test='$month = "06"'>
  55. <xsl:attribute name='month'><xsl:text>June</xsl:text></xsl:attribute>
  56. </xsl:when>
  57. <xsl:when test='$month = "07"'>
  58. <xsl:attribute name='month'><xsl:text>July</xsl:text></xsl:attribute>
  59. </xsl:when>
  60. <xsl:when test='$month = "08"'>
  61. <xsl:attribute name='month'><xsl:text>August</xsl:text></xsl:attribute>
  62. </xsl:when>
  63. <xsl:when test='$month = "09"'>
  64. <xsl:attribute name='month'><xsl:text>September</xsl:text></xsl:attribute>
  65. </xsl:when>
  66. <xsl:when test='$month = "10"'>
  67. <xsl:attribute name='month'><xsl:text>October</xsl:text></xsl:attribute>
  68. </xsl:when>
  69. <xsl:when test='$month = "11"'>
  70. <xsl:attribute name='month'><xsl:text>November</xsl:text></xsl:attribute>
  71. </xsl:when>
  72. <xsl:when test='$month = "12"'>
  73. <xsl:attribute name='month'><xsl:text>December</xsl:text></xsl:attribute>
  74. </xsl:when>
  75. <xsl:otherwise>
  76. <xsl:attribute name='month'><xsl:text></xsl:text></xsl:attribute>
  77. </xsl:otherwise>
  78. </xsl:choose>
  79. <xsl:attribute name='year'><xsl:value-of select='$year'/></xsl:attribute>
  80. </date>
  81. </front>
  82. <seriesInfo>
  83. <xsl:attribute name='name'><xsl:text>XSF XEP</xsl:text></xsl:attribute>
  84. <xsl:attribute name='value'><xsl:value-of select='/xep/header/number'/></xsl:attribute>
  85. </seriesInfo>
  86. <format>
  87. <xsl:attribute name='type'><xsl:text>HTML</xsl:text></xsl:attribute>
  88. <xsl:attribute name='target'><xsl:text>http://xmpp.org/extensions/xep-</xsl:text><xsl:value-of select='/xep/header/number'/><xsl:text>.html</xsl:text></xsl:attribute>
  89. </format>
  90. </reference>
  91. </xsl:template>
  92. <xsl:template match='author'>
  93. <author>
  94. <xsl:variable name='fname' select='firstname'/>
  95. <xsl:choose>
  96. <xsl:when test='starts-with($fname,"A")'><xsl:attribute name='initials'><xsl:text>A.</xsl:text></xsl:attribute></xsl:when>
  97. <xsl:when test='starts-with($fname,"B")'><xsl:attribute name='initials'><xsl:text>B.</xsl:text></xsl:attribute></xsl:when>
  98. <xsl:when test='starts-with($fname,"C")'><xsl:attribute name='initials'><xsl:text>C.</xsl:text></xsl:attribute></xsl:when>
  99. <xsl:when test='starts-with($fname,"D")'><xsl:attribute name='initials'><xsl:text>D.</xsl:text></xsl:attribute></xsl:when>
  100. <xsl:when test='starts-with($fname,"E")'><xsl:attribute name='initials'><xsl:text>E.</xsl:text></xsl:attribute></xsl:when>
  101. <xsl:when test='starts-with($fname,"F")'><xsl:attribute name='initials'><xsl:text>F.</xsl:text></xsl:attribute></xsl:when>
  102. <xsl:when test='starts-with($fname,"G")'><xsl:attribute name='initials'><xsl:text>G.</xsl:text></xsl:attribute></xsl:when>
  103. <xsl:when test='starts-with($fname,"H")'><xsl:attribute name='initials'><xsl:text>H.</xsl:text></xsl:attribute></xsl:when>
  104. <xsl:when test='starts-with($fname,"I")'><xsl:attribute name='initials'><xsl:text>I.</xsl:text></xsl:attribute></xsl:when>
  105. <xsl:when test='starts-with($fname,"J")'><xsl:attribute name='initials'><xsl:text>J.</xsl:text></xsl:attribute></xsl:when>
  106. <xsl:when test='starts-with($fname,"K")'><xsl:attribute name='initials'><xsl:text>K.</xsl:text></xsl:attribute></xsl:when>
  107. <xsl:when test='starts-with($fname,"L")'><xsl:attribute name='initials'><xsl:text>L.</xsl:text></xsl:attribute></xsl:when>
  108. <xsl:when test='starts-with($fname,"M")'><xsl:attribute name='initials'><xsl:text>M.</xsl:text></xsl:attribute></xsl:when>
  109. <xsl:when test='starts-with($fname,"N")'><xsl:attribute name='initials'><xsl:text>N.</xsl:text></xsl:attribute></xsl:when>
  110. <xsl:when test='starts-with($fname,"O")'><xsl:attribute name='initials'><xsl:text>O.</xsl:text></xsl:attribute></xsl:when>
  111. <xsl:when test='starts-with($fname,"P")'><xsl:attribute name='initials'><xsl:text>P.</xsl:text></xsl:attribute></xsl:when>
  112. <xsl:when test='starts-with($fname,"Q")'><xsl:attribute name='initials'><xsl:text>Q.</xsl:text></xsl:attribute></xsl:when>
  113. <xsl:when test='starts-with($fname,"R")'><xsl:attribute name='initials'><xsl:text>R.</xsl:text></xsl:attribute></xsl:when>
  114. <xsl:when test='starts-with($fname,"S")'><xsl:attribute name='initials'><xsl:text>S.</xsl:text></xsl:attribute></xsl:when>
  115. <xsl:when test='starts-with($fname,"T")'><xsl:attribute name='initials'><xsl:text>T.</xsl:text></xsl:attribute></xsl:when>
  116. <xsl:when test='starts-with($fname,"U")'><xsl:attribute name='initials'><xsl:text>U.</xsl:text></xsl:attribute></xsl:when>
  117. <xsl:when test='starts-with($fname,"V")'><xsl:attribute name='initials'><xsl:text>V.</xsl:text></xsl:attribute></xsl:when>
  118. <xsl:when test='starts-with($fname,"W")'><xsl:attribute name='initials'><xsl:text>W.</xsl:text></xsl:attribute></xsl:when>
  119. <xsl:when test='starts-with($fname,"X")'><xsl:attribute name='initials'><xsl:text>X.</xsl:text></xsl:attribute></xsl:when>
  120. <xsl:when test='starts-with($fname,"Y")'><xsl:attribute name='initials'><xsl:text>Y.</xsl:text></xsl:attribute></xsl:when>
  121. <xsl:when test='starts-with($fname,"Z")'><xsl:attribute name='initials'><xsl:text>Z.</xsl:text></xsl:attribute></xsl:when>
  122. <xsl:otherwise>
  123. <xsl:attribute name='initals'><xsl:text></xsl:text></xsl:attribute>
  124. </xsl:otherwise>
  125. </xsl:choose>
  126. <xsl:attribute name='surname'><xsl:value-of select='surname'/></xsl:attribute>
  127. <xsl:attribute name='fullname'><xsl:value-of select='firstname'/><xsl:text> </xsl:text><xsl:value-of select='surname'/></xsl:attribute>
  128. <organization/>
  129. <address>
  130. <email><xsl:value-of select='email'/></email>
  131. </address>
  132. </author>
  133. </xsl:template>
  134. </xsl:stylesheet>