|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
-->
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
|
|
Packit |
e4b6da |
exclude-result-prefixes="doc"
|
|
Packit |
e4b6da |
version='1.0'
|
|
Packit |
e4b6da |
xml:lang="en">
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<doc:mode mode="for-label" xmlns="">
|
|
Packit |
e4b6da |
<refpurpose>Provides access to element labels</refpurpose>
|
|
Packit |
e4b6da |
<refdescription>
|
|
Packit |
e4b6da |
<para>Processing an element in the
|
|
Packit |
e4b6da |
<literal role="mode">for-label</literal> mode produces the
|
|
Packit |
e4b6da |
element label.</para>
|
|
Packit |
e4b6da |
</refdescription>
|
|
Packit |
e4b6da |
</doc:mode>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="*[@label!='']" priority="2.0" mode="for-label">
|
|
Packit |
e4b6da |
<xsl:value-of select="@label" />
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="*" mode="for-label">
|
|
Packit |
e4b6da |
<xsl:call-template name="user-message">
|
|
Packit |
e4b6da |
<xsl:with-param name="key">Erroneous request for the label of this element</xsl:with-param>
|
|
Packit |
e4b6da |
</xsl:call-template>
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="qandaentry" mode="for-label">
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
count="qandadiv|qandaentry"
|
|
Packit |
e4b6da |
format="1.1." />
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="question" mode="for-label">
|
|
Packit |
e4b6da |
<xsl:choose>
|
|
Packit |
e4b6da |
<xsl:when test="label">
|
|
Packit |
e4b6da |
<xsl:apply-templates select="label" mode="label" />
|
|
Packit |
e4b6da |
</xsl:when>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:when test="ancestor::qandaset/@defaultlabel='none'">
|
|
Packit |
e4b6da |
</xsl:when>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:when test="ancestor::qandaset/@defaultlabel='number'">
|
|
Packit |
e4b6da |
<xsl:apply-templates select=".." mode="for-label" />
|
|
Packit |
e4b6da |
</xsl:when>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:otherwise>
|
|
Packit |
e4b6da |
<xsl:call-template name="gentext-label" />
|
|
Packit |
e4b6da |
</xsl:otherwise>
|
|
Packit |
e4b6da |
</xsl:choose>
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="answer" mode="for-label">
|
|
Packit |
e4b6da |
<xsl:choose>
|
|
Packit |
e4b6da |
<xsl:when test="label">
|
|
Packit |
e4b6da |
<xsl:apply-templates select="label" mode="label" />
|
|
Packit |
e4b6da |
</xsl:when>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:when test="ancestor::qandaset/@defaultlabel='none'">
|
|
Packit |
e4b6da |
</xsl:when>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:when test="ancestor::qandaset/@defaultlabel='number'">
|
|
Packit |
e4b6da |
</xsl:when>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:otherwise>
|
|
Packit |
e4b6da |
<xsl:call-template name="gentext-label" />
|
|
Packit |
e4b6da |
</xsl:otherwise>
|
|
Packit |
e4b6da |
</xsl:choose>
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="*" mode="label">
|
|
Packit |
e4b6da |
<xsl:param name="allow-anchors" select="false()" />
|
|
Packit |
e4b6da |
<xsl:choose>
|
|
Packit |
e4b6da |
<xsl:when test="$allow-anchors">
|
|
Packit |
e4b6da |
<xsl:apply-templates />
|
|
Packit |
e4b6da |
</xsl:when>
|
|
Packit |
e4b6da |
<xsl:otherwise>
|
|
Packit |
e4b6da |
<xsl:apply-templates mode="no-anchors" />
|
|
Packit |
e4b6da |
</xsl:otherwise>
|
|
Packit |
e4b6da |
</xsl:choose>
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="text()" mode="label">
|
|
Packit |
e4b6da |
<xsl:value-of select="." />
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
</xsl:stylesheet>
|