Changeset 29936


Ignore:
Timestamp:
2015-05-30T10:55:59+12:00 (9 years ago)
Author:
davidb
Message:

Introduction of new template to help with including empty 'div' elements in the GS3 XSLT processing pipeline

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/transform/config_format.xsl

    r29834 r29936  
    104104    </xsl:template>
    105105
     106    <!-- a template for 'div' that doesn't trigger the
     107         self-closing problem when being rendered as HTML by using
     108         xslt:value-of="''" to ensure element doesn't become empty
     109         when the XSLT processes it (which would then result in it
     110         being changed into a self-closing element, which then is
     111         incorrectly rendered as HTML).  Doing thing with the
     112         value-of is better then injecting an xsl:comment in
     113         (another approach we have used in the past) as the
     114         comment approach then actually turns up in the final
     115         HTML.  This can lead to further complications if
     116         Javascript using the 'empty' div truely expects it to
     117         have no connent of any form.
     118    -->
     119
     120    <xsl:template match="gsf:div">
     121      <div>
     122        <xsl:for-each select="@*">
     123          <xsl:attribute name="{name()}">
     124        <xsl:value-of select="."/>
     125          </xsl:attribute>
     126        </xsl:for-each>
     127            <xsl:apply-templates/>
     128        <xslt:value-of select="''" />
     129      </div>
     130    </xsl:template>
    106131
    107132    <xsl:template match="gsf:image">
    108133        <xslt:variable name="metaName">
    109134            <xsl:choose>
    110                 <xsl:when test="@type = 'thumb'">Thumb</xsl:when>
     135                <xsl:when test="@type = 'thumb'">Thumb</xsl:when>
    111136                <xsl:when test="@type = 'screen'">Screen</xsl:when>
    112137                <xsl:when test="@type = 'source'">SourceFile</xsl:when>
Note: See TracChangeset for help on using the changeset viewer.