General Interface is an open source project hosted by the Dojo Foundation

Matrix column value template

Value template is an XSL template fragment used by as part of the transformation from CDF XML data into the View HTML. Value template is faster than format handler.

The following displays a default text of "- NO DATA -" when the CDF attribute is "" empty string.

<xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:param name="jsx_row_number"/>
  <xsl:choose>
    <xsl:when test="{0} != ''">
       <xsl:value-of select="{0}"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:attribute name="style">background-color:#EEEEEE;color:#999999;margin:-3px;padding:3px;</xsl:attribute>
      - NO DATA -
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

All tags (e.g., TR, TD, DIV) now have their attributes updated, not just text content. Note that the fix does not address missing attributes or missing styles. This means that updates that remove a style or attribute may not update correctly.

CORRECT

<xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:param name="jsx_row_number"/>
  <xsl:choose>
    <xsl:when test="{0} != ''">
      <xsl:attribute name="style">font-weight:bold;color:;</xsl:attribute>
    </xsl:when>
    <xsl:otherwise>
      <xsl:attribute name="style">font-weight:bold;color:red;</xsl:attribute>
    </xsl:otherwise>
  </xsl:choose>
  <xsl:value-of select="{0}"/>
</xsl:template> 

INCORRECT:

<xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:param name="jsx_row_number"/>
  <xsl:choose>
    <xsl:when test="{0} != ''">
      <xsl:attribute name="style">font-weight:bold;</xsl:attribute>
    </xsl:when>
    <xsl:otherwise>
      <xsl:attribute name="style">font-weight:bold;color:red;</xsl:attribute>
    </xsl:otherwise>
  </xsl:choose>
  <xsl:value-of select="{0}"/>
</xsl:template> 

Color attribute is not specified when value is not empty.

Labels

matrix matrix Delete
value value Delete
template template Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.