Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'src/current/include/preproc/expand.xsl')
-rw-r--r--src/current/include/preproc/expand.xsl40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/current/include/preproc/expand.xsl b/src/current/include/preproc/expand.xsl
index f023df1..c43fcc2 100644
--- a/src/current/include/preproc/expand.xsl
+++ b/src/current/include/preproc/expand.xsl
@@ -123,6 +123,46 @@
<!--
+ Translate dimension aliases (e.g. scaler, vector, matrix) into respective
+ numeric representations.
+-->
+<xsl:template mode="preproc:expand" priority="8"
+ match="c:*[ @dim
+ and not( string( @dim ) castable as xs:integer ) ]">
+ <xsl:copy>
+ <xsl:sequence select="@*" />
+
+ <!-- replace dim with numeric -->
+ <xsl:attribute name="dim">
+ <xsl:choose>
+ <xsl:when test="@dim = 'scaler' or @dim = ''">
+ <xsl:sequence select="0" />
+ </xsl:when>
+
+ <xsl:when test="@dim = 'vector'">
+ <xsl:sequence select="1" />
+ </xsl:when>
+
+ <xsl:when test="@dim = 'matrix'">
+ <xsl:sequence select="2" />
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:message terminate="yes"
+ select="concat(
+ '!!! [preproc] error: ',
+ 'unknown dimension alias ''',
+ @dim, '''' )" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <xsl:sequence select="node()" />
+ </xsl:copy>
+</xsl:template>
+
+
+<!--
Give let's a name so that they may be easily referenced uniquely
-->
<xsl:template match="c:let[ not( @name ) ]" mode="preproc:expand" priority="5">