Skip to content

Instantly share code, notes, and snippets.

@jessgusclark
Last active April 18, 2016 19:12
Show Gist options
  • Save jessgusclark/c39d593c77aaaa60deccc2862ce3e47e to your computer and use it in GitHub Desktop.
Save jessgusclark/c39d593c77aaaa60deccc2862ce3e47e to your computer and use it in GitHub Desktop.
<!-- Get the first character of the title (example: If 'accounting' this will return 'A') -->
<xsl:variable name="current-letter" select="upper-case(
substring(
$page-content/document/ouc:properties/parameter[@name='database-name'],1,1
)
)"/>
<!-- If previous data file exists, get it, else leave the variable $previous-letter as blank -->
<xsl:variable name="previous-letter">
<xsl:if test="preceding-sibling::file[1] != ''">
<xsl:value-of select="upper-case(
substring(
doc(concat($data-location,'/', preceding-sibling::file[1]))/document/ouc:properties/parameter[@name='database-name'],1,1
)
)" />
</xsl:if>
</xsl:variable>
<!-- If the first character of the previous title does not equal the first character of the current title, display a header -->
<xsl:if test="$previous-letter != $current-letter">
<h2 class="break-above"><xsl:value-of select="$current-letter" /></h2>
</xsl:if>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment