Controlling Variable and Value Label Display
The display of variable names and/or labels and values and/or value
labels in pivot tables is determined by the current settings for SET TVARS
and SET
TNUMBERS
—the corresponding text
attributes in the OXML also reflect those settings.
The system default is to display labels when they exist and names
or values when they don't. The settings can be changed to always show
names or values and never show labels or always show both.
The XSLT templates showVarInfo and showValueInfo are designed to ignore those settings and always show both names or values and labels (if present).
<!--display both variable names and labels-->
<xsl:template name="showVarInfo">
<p>
<xsl:text>Variable Name: </xsl:text>
<xsl:value-of select="@varName"/>
</p>
<xsl:if test="@label">
<p>
<xsl:text>Variable Label: </xsl:text>
<xsl:value-of select="@label"/>
</p>
</xsl:if>
</xsl:template>
<!--display both values and value labels-->
<xsl:template name="showValueInfo">
<xsl:choose>
<!--Numeric vars have a number attribute,
string vars have a string attribute -->
<xsl:when test="parent::*/@number">
<xsl:value-of select="parent::*/@number"/>
</xsl:when>
<xsl:when test="parent::*/@string">
<xsl:value-of select="parent::*/@string"/>
</xsl:when>
</xsl:choose>
<xsl:if test="parent::*/@label">
<xsl:text>: </xsl:text>
<xsl:value-of select="parent::*/@label"/>
</xsl:if>
</xsl:template>
-
<xsl:text>Variable Name: </xsl:text>
and<xsl:value-of select="@varName"/>
display the text "Variable Name:" followed by the variable name. -
<xsl:if test="@label">
checks to see if the variable has a defined label. - If the variable has a defined label,
<xsl:text>Variable Label: </xsl:text>
and<xsl:value-of select="@label"/>
display the text "Variable Label:" followed by the defined variable label. - Values and value labels are handled in a similar
fashion, except instead of a
varName
attribute, values will have either anumber
attribute or astring
attribute.