[yelp-xsl] mallard/html: Be robust against multiple desc elements



commit 01899300c81b9805c9483ea429a1b37af5dbf221
Author: Shaun McCance <shaunm gnome org>
Date:   Sat Feb 1 09:41:03 2014 -0500

    mallard/html: Be robust against multiple desc elements
    
    Future Mallard versions may allow multiple descs with role
    attributes, just like info titles.

 xslt/mallard/html/mal2html-block.xsl |   12 ++++++------
 xslt/mallard/html/mal2html-links.xsl |    6 +++---
 xslt/mallard/html/mal2html-table.xsl |    4 ++--
 xslt/mallard/html/mal2html-ui.xsl    |    2 +-
 4 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/xslt/mallard/html/mal2html-block.xsl b/xslt/mallard/html/mal2html-block.xsl
index f9468a8..24ccdd8 100644
--- a/xslt/mallard/html/mal2html-block.xsl
+++ b/xslt/mallard/html/mal2html-block.xsl
@@ -297,14 +297,14 @@ in accordance with the Mallard specification on fallback block content.
           </xsl:call-template>
         </xsl:attribute>
       </a>
-      <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+      <xsl:apply-templates mode="mal2html.block.mode" select="mal:title[1]"/>
       <div class="region">
         <div class="contents">
           <xsl:for-each select="*[not(self::mal:title or self::mal:desc)]">
             <xsl:apply-templates mode="mal2html.block.mode" select="."/>
           </xsl:for-each>
         </div>
-        <xsl:apply-templates mode="mal2html.block.mode" select="mal:desc"/>
+        <xsl:apply-templates mode="mal2html.block.mode" select="mal:desc[1]"/>
       </div>
     </div>
   </div>
@@ -330,9 +330,9 @@ in accordance with the Mallard specification on fallback block content.
     </xsl:call-template>
     <xsl:call-template name="mal2html.ui.expander.data"/>
     <div class="inner">
-      <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+      <xsl:apply-templates mode="mal2html.block.mode" select="mal:title[1]"/>
       <div class="region">
-        <xsl:apply-templates mode="mal2html.block.mode" select="mal:desc"/>
+        <xsl:apply-templates mode="mal2html.block.mode" select="mal:desc[1]"/>
         <div class="contents">
           <xsl:for-each select="*[not(self::mal:title or self::mal:desc)]">
             <xsl:apply-templates mode="mal2html.block.mode" select="."/>
@@ -525,9 +525,9 @@ in accordance with the Mallard specification on fallback block content.
     </xsl:call-template>
     <xsl:call-template name="mal2html.ui.expander.data"/>
     <div class="inner">
-      <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+      <xsl:apply-templates mode="mal2html.block.mode" select="mal:title[1]"/>
       <div class="region">
-        <xsl:apply-templates mode="mal2html.block.mode" select="mal:desc"/>
+        <xsl:apply-templates mode="mal2html.block.mode" select="mal:desc[1]"/>
         <div class="contents">
           <xsl:for-each select="*[not(self::mal:title or self::mal:desc)]">
             <xsl:apply-templates mode="mal2html.block.mode" select="."/>
diff --git a/xslt/mallard/html/mal2html-links.xsl b/xslt/mallard/html/mal2html-links.xsl
index 763d527..3bf23b7 100644
--- a/xslt/mallard/html/mal2html-links.xsl
+++ b/xslt/mallard/html/mal2html-links.xsl
@@ -335,7 +335,7 @@ a link for each target.
         <xsl:if test="$desc">
           <span class="desc">
             <xsl:text> &#x2014; </xsl:text>
-            <xsl:apply-templates mode="mal2html.inline.mode" select="$desc/node()"/>
+            <xsl:apply-templates mode="mal2html.inline.mode" select="$desc[1]/node()"/>
           </span>
         </xsl:if>
       </xsl:if>
@@ -929,7 +929,7 @@ when determining which links to output.
         <xsl:if test="$desc">
           <div class="desc">
             <span class="desc">
-              <xsl:apply-templates mode="mal2html.inline.mode" select="$desc/node()"/>
+              <xsl:apply-templates mode="mal2html.inline.mode" select="$desc[1]/node()"/>
             </span>
           </div>
         </xsl:if>
@@ -1129,7 +1129,7 @@ when determining which links to output.
             <xsl:variable name="desc" select="$target/mal:info/mal:desc"/>
             <xsl:if test="$desc">
               <div class="desc">
-                <xsl:apply-templates mode="mal2html.inline.mode" select="$desc/node()"/>
+                <xsl:apply-templates mode="mal2html.inline.mode" select="$desc[1]/node()"/>
               </div>
             </xsl:if>
           </xsl:if>
diff --git a/xslt/mallard/html/mal2html-table.xsl b/xslt/mallard/html/mal2html-table.xsl
index 5215070..b99595c 100644
--- a/xslt/mallard/html/mal2html-table.xsl
+++ b/xslt/mallard/html/mal2html-table.xsl
@@ -181,9 +181,9 @@ REMARK: Describe this module
     </xsl:call-template>
     <xsl:call-template name="mal2html.ui.expander.data"/>
     <div class="inner">
-      <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+      <xsl:apply-templates mode="mal2html.block.mode" select="mal:title[1]"/>
       <div class="region">
-        <xsl:apply-templates mode="mal2html.block.mode" select="mal:desc"/>
+        <xsl:apply-templates mode="mal2html.block.mode" select="mal:desc[1]"/>
         <table class="table">
           <xsl:if test="$style != ''">
             <xsl:attribute name="style">
diff --git a/xslt/mallard/html/mal2html-ui.xsl b/xslt/mallard/html/mal2html-ui.xsl
index 0d36ae9..d70e631 100644
--- a/xslt/mallard/html/mal2html-ui.xsl
+++ b/xslt/mallard/html/mal2html-ui.xsl
@@ -198,7 +198,7 @@ This template handles link sorting.
             <xsl:if test="not(contains(concat(' ', $node/@style, ' '), ' nodesc '))">
               <xsl:if test="$target/mal:info/mal:desc">
                 <span class="desc">
-                  <xsl:apply-templates select="$target/mal:info/mal:desc/node()"/>
+                  <xsl:apply-templates select="$target/mal:info/mal:desc[1]/node()"/>
                 </span>
               </xsl:if>
             </xsl:if>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]