diff --git a/modules/cross-references.xml b/modules/cross-references.xml index e0a8571..212ece6 100644 --- a/modules/cross-references.xml +++ b/modules/cross-references.xml @@ -114,6 +114,33 @@ <!-- + List item reference. + + There are WAY too many different list element types to properly specify the match. Let's just stick with "item". + + Items don't have a corresponding "name", so the surrounding text will have to supply it. Make sure to include such text in any hyperlink associated with the reference. + --> + <template name="list-item-reference" match="item" mode="reference"> + <common formats="/latex/xelatex/"> + <xsl:text>\ref*{</xsl:text> + <xsl:value-of select="@label" /> + <xsl:text>}</xsl:text> + </common> + <common formats="/html/xhtml/"> + <xsl:choose> + <xsl:when test="$showanswers = ('yes', 'y', 'true', 't', '1')"> + <!-- it only really makes sense to count "item" elements within the same list --> + <xsl:number count="item" level="single" format="1" /> + </xsl:when> + <xsl:otherwise> + <xsl:number count="item[not(ancestor::answer) and not(ancestor::omit) and not(ancestor::comment)]" level="single" format="1" /> + </xsl:otherwise> + </xsl:choose> + </common> + </template> + + + <!-- Common template for item page references, as they're identical for all items. Standalone page references (i.e., not to a specific item) are dealt with below. Only relevant to (Xe)LaTeX as (X)HTML doesn't have pages. --> <template name="item-page-reference" match="section|figure|table|exercise" mode="page-reference">