XSLT 2.0 processing problem with key values and apply-template.
Source xml
<?xml version="1.0" encoding="UTF-8"?>
<ELEMENTS>
<EA-NUMERICAL ID="MyFloat_20_62045">
<NAME>MyFloat</NAME>
</EA-NUMERICAL>
<RANGEABLE-VALUE-TYPE ID="PercentType_20_62177">
<NAME>PercentType</NAME>
<BASE-RANGEABLE-REF TYPE="EA-NUMERICAL">/MyFloat_20_62045</BASE-RANGEABLE-REF>
</RANGEABLE-VALUE-TYPE>
<RANGEABLE-VALUE-TYPE ID="TorqueType_20_62239">
<NAME>TorqueType</NAME>
<BASE-RANGEABLE-REF TYPE="EA-NUMERICAL">/MyFloat_20_62045</BASE-RANGEABLE-REF>
</RANGEABLE-VALUE-TYPE>
</ELEMENTS>
XSLT's key definition for reporting the RANGEABLE-VALUE-TYPE:
<xsl:key name="by-rangeable-value-type" match="RANGEABLE-VALUE-TYPE" use="BASE-RANGEABLE-REF"/>
<xsl:key name="ea-numerical-type" match="EA-NUMERICAL" use="@ID"/>
And then I have two templates (first one for full information and another one for the case when EA-NUMERICAL has been reported earlier):
<!-- Reporting the full information -->
<xsl:template match="RANGEABLE-VALUE-TYPE[. is key('by-rangeable-value-type', BASE-RANGEABLE-REF)[1]]">
</xsl:template>
<!-- Reporting the reference -->
<xsl:template match="RANGEABLE-VALUE-TYPE[not(. is key('by-rangeable-value-type', BASE-RANGEABLE-REF)[1])]">
<object>
<xsl:attribute name="href">#<xsl:value-of select="tokenize(BASE-RANGEABLE-REF, '/')[last()]"/></xsl:attribute>
</object>
</xsl:template>
Template call:
<xsl:apply-templates select="key('ea-numerical-type', tokenize(BASE-RANGEABLE-REF, '/')[last()])"/>
Problem is if the EA-NUMERICAL is be reported elsewhere/earlier from another template.
Now during the 1st RANGEABLE-VALUE-TYPE processing it will be reported fully again (by utilizing the first of the templates, like the key definition states). For the 2nd RANGEABLE-VALUE-TYPE, it uses the reference template correctly.
But is there a way in XSLT 2.0 to create/combine a key with several different element or attribute values? (In this sample combination of tokenized BASE-RANGEABLE-REF values and EA-NUMERICAL id attribute value?)