Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-01-31 16:46:35 -0500
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-02-01 13:08:03 -0500
commitc5fcc3ccd2ac9e99740cc3f338d8db4643a491fc (patch)
tree344b4f4d187d27beb234566341d96a74d8d7f97d
parentc0370690f440f961c23297c2fe5a231727470a9c (diff)
downloadtame-c5fcc3ccd2ac9e99740cc3f338d8db4643a491fc.tar.gz
tame-c5fcc3ccd2ac9e99740cc3f338d8db4643a491fc.tar.bz2
tame-c5fcc3ccd2ac9e99740cc3f338d8db4643a491fc.zip
template: Add prefix and suffix conditional support (feature)
* src/current/include/preproc/template.xsl (preproc:apply-template-cmp): Add @prefix and @suffix.
-rw-r--r--src/current/include/preproc/template.xsl32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/current/include/preproc/template.xsl b/src/current/include/preproc/template.xsl
index a4a47d9..6c6bcf4 100644
--- a/src/current/include/preproc/template.xsl
+++ b/src/current/include/preproc/template.xsl
@@ -805,6 +805,38 @@
</xsl:template>
+<xsl:template mode="preproc:apply-template-cmp" priority="5"
+ match="lv:*[ @prefix ]">
+ <xsl:param name="negate" select="false()" />
+ <xsl:param name="param-value" />
+ <xsl:param name="cmp-value" />
+
+ <xsl:variable name="has-prefix" as="xs:boolean"
+ select="starts-with( $param-value, $cmp-value )" />
+
+ <xsl:if test="( $negate and not( $has-prefix ) )
+ or ( not( $negate ) and $has-prefix )">
+ <xsl:apply-templates select="*" mode="preproc:apply-template" />
+ </xsl:if>
+</xsl:template>
+
+
+<xsl:template mode="preproc:apply-template-cmp" priority="5"
+ match="lv:*[ @suffix ]">
+ <xsl:param name="negate" select="false()" />
+ <xsl:param name="param-value" />
+ <xsl:param name="cmp-value" />
+
+ <xsl:variable name="has-suffix" as="xs:boolean"
+ select="ends-with( $param-value, $cmp-value )" />
+
+ <xsl:if test="( $negate and not( $has-suffix ) )
+ or ( not( $negate ) and $has-suffix )">
+ <xsl:apply-templates select="*" mode="preproc:apply-template" />
+ </xsl:if>
+</xsl:template>
+
+
<xsl:template match="lv:*[not(@*[not(local-name()='name')])]" mode="preproc:apply-template-cmp" priority="2">
<xsl:param name="negate" select="'false'" />
<xsl:param name="param-value" />