http://www.w3.org/1999/XSL/Transform

c.resolveNode (id : string) : nodeset

The function resolveNode returns the xml node from the string reference originally created by generateId.

<xsl:variable name="id" select="c.generateId(root/element/@attribute)" />
<xsl:value-of select="c.resolveNode($id)" />

This function is often used for resolving the path for binary data. In one case, however, this only works under certain conditions. If the binary reference is an attribute in XML and the mimetype for example is to be queried after resolving the ID, then it does not work.

The following example shows a workaround for this case.

<xsl:stylesheet xmlns:reg="http://exslt.org/regular-expressions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:onion="http://onionworks.net/2004/data" version="1.0">
<xsl:template match="/">
<xsl:variable name="ref" select="c.resolveNode('E0E0A2')" />
<xsl:variable name="mimeType">
<xsl:choose>
<xsl:when test="count(reg:match($select, 'A\d', 'gi')) > 0">
<xsl:variable name="element" select="c.resolveNode(substring-before($select, 'A'))" />
<xsl:value-of select="$element/@*[local-name() = concat(local-name($ref), '.mimeType')]" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$ref/@onion:mimeType" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
</xsl:template>
</xsl:stylesheet>