[yelp-xsl] mal-if: Added if:supports function



commit e18ccaf49541d7beb56d418f7cecaf28840146eb
Author: Shaun McCance <shaunm gnome org>
Date:   Sun Jul 31 13:59:40 2011 -0400

    mal-if: Added if:supports function

 xslt/mallard/common/mal-if.xsl |   45 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/xslt/mallard/common/mal-if.xsl b/xslt/mallard/common/mal-if.xsl
index 4e229e4..a26a21e 100644
--- a/xslt/mallard/common/mal-if.xsl
+++ b/xslt/mallard/common/mal-if.xsl
@@ -49,6 +49,38 @@ if its argument is in this list.
 <xsl:variable name="_mal.if.env" select="concat(' ', $mal.if.env, ' ')"/>
 
 
+<!--@@==========================================================================
+mal.if.supports
+The list of supported technologies.
+:Revision:version="1.0" date="2011-07-31" status="review"
+
+This parameter takes a space-separated list of strings for the #{if:supports}
+conditional processing function. The #{if:supports} function will return #{true}
+if its argument is in this list or @{mal.if.supports.custom}.
+
+Do not change this parameter unless you are completely overriding the behavior
+of these stylesheets in a way that removes or changes features. To add support
+in a customization, use the @{mal.if.supports.custom} parameter.
+-->
+<xsl:param name="mal.if.supports" select="'1.0'"/>
+
+
+<!--@@==========================================================================
+mal.if.supports.custom
+The list of technologies supported by customizations.
+:Revision:version="1.0" date="2011-07-31" status="review"
+
+This parameter takes a space-separated list of strings for the #{if:supports}
+conditional processing function. The #{if:supports} function will return #{true}
+if its argument is in this list or @{mal.if.supports}.
+-->
+<xsl:param name="mal.if.supports.custom" select="'1.0'"/>
+
+
+<xsl:variable name="_mal.if.supports"
+              select="concat(' ', $mal.if.supports, ' ', $mal.if.supports.custom, ' ')"/>
+
+
 <!--**==========================================================================
 mal.if.test
 Test if a condition is true.
@@ -80,6 +112,7 @@ string #{'true'}. Otherwise, it outputs nothing.
   </xsl:choose>
 </xsl:template>
 
+
 <!--**==========================================================================
 mal.if.choose
 Gets the position of the first matching condition in #{if:choose}
@@ -137,4 +170,16 @@ If no #{if:when} elements are true, the output is empty.
   </xsl:choose>
 </func:function>
 
+<func:function name="if:supports">
+  <xsl:param name="tech"/>
+  <xsl:choose>
+    <xsl:when test="contains($_mal.if.supports, $tech)">
+      <func:result select="true()"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <func:result select="false()"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</func:function>
+
 </xsl:stylesheet>



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