Skip to content

Commit

Permalink
Handle enumerationLabel in s1kd-aspp -g
Browse files Browse the repository at this point in the history
If an enumeration has the attribute enumerationLabel, and the value in
the annotation matches it, this label will be used instead of the
literal value.
  • Loading branch information
kibook committed Aug 2, 2018
1 parent f26f4ee commit 3516799
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion tools/s1kd-aspp/generateDisplayText.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<xsl:template match="assert" mode="text">
<xsl:call-template name="applicPropertyName"/>
<xsl:text>: </xsl:text>
<xsl:apply-templates select="@applicPropertyValues|@actvalues" mode="text"/>
<xsl:call-template name="applicPropertyVal"/>
</xsl:template>

<xsl:template name="applicPropertyName">
Expand All @@ -57,6 +57,22 @@
</xsl:choose>
</xsl:template>

<xsl:template name="applicPropertyVal">
<xsl:param name="id" select="@applicPropertyIdent|@actidref"/>
<xsl:param name="type" select="@applicPropertyType|@actreftype"/>
<xsl:variable name="prop" select="//productAttribute[$type='prodattr' and @id=$id]|//prodattr[$type='prodattr' and @id=$id]|//cond[$type='condition' and @id=$id]|//condition[$type='condition' and @id=$id]"/>
<xsl:variable name="values" select="@applicPropertyValues|@actvalues"/>
<xsl:variable name="label" select="$prop/enumeration[@applicPropertyValues=$values]/@enumerationLabel"/>
<xsl:choose>
<xsl:when test="$label">
<xsl:value-of select="$label"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$values" mode="text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="@applicPropertyValues|@actvalues" mode="text">
<xsl:value-of select="translate(str:replace(., '|', ', '), '~', '-')"/>
</xsl:template>
Expand Down
2 changes: 1 addition & 1 deletion tools/s1kd-aspp/s1kd-aspp.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "identity.h"

#define PROG_NAME "s1kd-aspp"
#define VERSION "1.1.1"
#define VERSION "1.1.2"

/* ID for the inline <applic> element representing the whole data module's
* applicability. */
Expand Down

0 comments on commit 3516799

Please sign in to comment.