rendered paste body<?xml version="1.0" encoding="UTF-8"?>
<!-- Author: Sean Wheller sean@inwords.co.za -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes" encoding="UTF-8" version="1.0"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="glossdiv">
<xsl:element name="glossdiv">
<xsl:attribute name="id">
<xsl:value-of select="title"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="title">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="glossentry">
<xsl:if test="@id">
<xsl:copy-of select="."/>
</xsl:if>
<xsl:if test="not(@id)">
<xsl:for-each select=".">
<xsl:variable name="glossdivTitle">
<xsl:value-of select="//glossdiv/title"/>
</xsl:variable>
<xsl:variable name="idValue">
<xsl:value-of select="generate-id()"/>
</xsl:variable>
<xsl:element name="glossentry">
<xsl:attribute name="id">
<xsl:value-of select="concat($glossdivTitle, '-', $idValue)"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template match="glossterm">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="glossdef">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>