diff xslt/directive.xslt @ 171:6eeaa9e1f3b5

Made "appeared-in" an element, and added support for multiple "appeared-in" specifications.
author Ruslan Ermilov <ru@nginx.com>
date Thu, 03 Nov 2011 21:40:27 +0000
parents cd2698ea00ab
children 13f4de67fbb6
line wrap: on
line diff
--- a/xslt/directive.xslt
+++ b/xslt/directive.xslt
@@ -18,12 +18,7 @@
 
          </table>
 
-         <xsl:if test="(@appeared-in)">
-
-            <p>This directive appeared in version
-               <xsl:value-of select="@appeared-in"/>.
-            </p>
-         </xsl:if>
+         <xsl:apply-templates select="appeared-in"/>
 
       </div>
 
@@ -199,4 +194,43 @@
       </xsl:choose>
    </xsl:template>
 
+   <xsl:template match="appeared-in">
+      <xsl:choose>
+
+         <xsl:when test="last() = 1">
+
+            <p>This directive appeared in version
+               <xsl:apply-templates/>.
+            </p>
+         </xsl:when>
+
+         <xsl:otherwise>
+
+            <xsl:choose>
+               <xsl:when test="position() = 1">
+                  <xsl:text disable-output-escaping="yes">
+                        &lt;p&gt;
+                    </xsl:text>
+                    This directive appeared in versions
+                  <xsl:apply-templates/>
+                  <xsl:if test="last() &gt; 2">
+                     <xsl:text>, </xsl:text>
+                  </xsl:if>
+               </xsl:when>
+               <xsl:when test="position() != last()">
+                  <xsl:apply-templates/>
+                  <xsl:text>, </xsl:text>
+               </xsl:when>
+               <xsl:otherwise>
+                    and
+                  <xsl:apply-templates/>.
+                  <xsl:text disable-output-escaping="yes">
+                        &lt;/p&gt;
+                    </xsl:text>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
 </xsl:stylesheet>