]> git.draconx.ca Git - homepage.git/blobdiff - layouts/functions.xsl
M48T59Y battery replacement
[homepage.git] / layouts / functions.xsl
index a88c3380cc88f3bb0d59491bcb6e33f8316f8830..bbaf90e34bbf971bbddf399fd77e73be398b4bb8 100644 (file)
@@ -1,7 +1,7 @@
 <!--
   Nick's web site: XSLT helper functions.
 
-  Copyright © 2019-2021 Nick Bowler
+  Copyright © 2019-2022 Nick Bowler
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   </func:result>
 </func:function>
 
+<!--
+  f:contains-token(list, token)
+  Returns true iff the space-separated list contains the given token
+-->
+<func:function name='f:contains-token'>
+  <xsl:param name='haystack' />
+  <xsl:param name='needle' />
+
+  <func:result select='contains(
+                         concat(" ", normalize-space($haystack), " "),
+                         concat(" ", normalize-space($needle), " ")
+                       )' />
+</func:function>
+
 </xsl:stylesheet>