Skip to main content

The PreTeXt Guide

Section 48.3 Locating Other Nodes

Should you need to locate a node some other place in a document, via some sort of a reference by an identifier, be sure to use the interface provided by the id-lookup-by-name named template. It accepts a string (the value of the identifier in the reference) and returns an xml:id value that can be used with the XSL id() function to return the desired node (as a node-set). Use a pattern such as the following, paying particular attention to the name of the variable supplied to the id() function.
<xsl:variable name="target-id">
    <xsl:call-template name="id-lookup-by-name">
        <xsl:with-param name="name" select="normalize-space(@ref)"/>
    </xsl:call-template>
</xsl:variable>
<xsl:variable name="target" select="id($target-id)" />
You have attempted of activities on this page.