TEI stylesheet dealing with elements from the linking module.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version. This library is
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details. You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
<xsl:template name="makeTEILink"><xsl:param name="ptr" as="xs:boolean" select="false()"/><!-- is this a ptr or a ref? --><xsl:choose><!-- If there is a target attribute starting with #, it is always a local reference --><xsl:when test="@target and starts-with(@target,'#')"><xsl:call-template name="makeInternalLink"><xsl:with-param name="target" select="substring(@target,2)"/><xsl:with-param name="ptr" select="$ptr"/><xsl:with-param name="dest"><xsl:call-template name="generateEndLink"><xsl:with-param name="where"><xsl:value-of select="substring(@target,2)"/></xsl:with-param></xsl:call-template></xsl:with-param></xsl:call-template></xsl:when><!-- if we are doing TEI P4, all targets are local --><xsl:when test="@target and $teiP4Compat='true'"><xsl:call-template name="makeInternalLink"><xsl:with-param name="target" select="@target"/><xsl:with-param name="ptr" select="$ptr"/><xsl:with-param name="dest"><xsl:call-template name="generateEndLink"><xsl:with-param name="where"><xsl:value-of select="@target"/></xsl:with-param></xsl:call-template></xsl:with-param></xsl:call-template></xsl:when><!-- other uses of target means it is external --><xsl:when test="@target"><xsl:call-template name="makeExternalLink"><xsl:with-param name="ptr" select="$ptr"/><xsl:with-param name="dest"><xsl:value-of select="@target"/></xsl:with-param></xsl:call-template></xsl:when><!-- If there is a url attribute starting with #, it is a local
reference --><xsl:when test="@url and starts-with(@url,'#')"><xsl:call-template name="makeInternalLink"><xsl:with-param name="target" select="substring(@url,2)"/><xsl:with-param name="ptr" select="$ptr"/><xsl:with-param name="dest"><xsl:call-template name="generateEndLink"><xsl:with-param name="where"><xsl:value-of select="substring(@url,2)"/></xsl:with-param></xsl:call-template></xsl:with-param></xsl:call-template></xsl:when><!-- otherwise it is an external URL --><xsl:when test="@url"><xsl:call-template name="makeExternalLink"><xsl:with-param name="ptr" select="$ptr"/><xsl:with-param name="dest"><xsl:value-of select="@url"/></xsl:with-param></xsl:call-template></xsl:when><!-- A doc attribute means an external reference --><xsl:when test="@doc"><xsl:call-template name="makeExternalLink"><xsl:with-param name="ptr" select="$ptr"/><xsl:with-param name="dest"><xsl:value-of select="unparsed-entity-uri(@doc)"/></xsl:with-param></xsl:call-template></xsl:when><xsl:otherwise><!--
<xsl:for-each select="@*">
[[markup error: <xsl:value-of select="name(.)"/>=<xsl:value-of select="."/>]]
</xsl:for-each>
--><xsl:apply-templates/></xsl:otherwise></xsl:choose></xsl:template>