Matching of attribute values
Hi,
I have a basic question of matching of attribute values:
If I have a document fragment:
<model>
<enum name="ABC">
<enunMember name="member1">
<value>0</value>
</enumMember>
<enunMember name="member2">
<value>1</value>
</enumMember>
</enum>
<enum name="XYZ">
<enumMember name="member5">
<value>20</value>
</enumMember>
<enumMember name="member7">
<value>22</value>
</enumMember>
</enum>
<class>
<attribute name="attr1">
<datatype>
<enumRef name= "ABC">
<value>20</value>
</enumRef>
</datatype>
</attribute>
</class>
</model>
---------------------------------------------------------------------------------------------------
When processing an 'attribute', I want to dump out the type information of the referenced "enum". I am struggling with the syntax to find the related "enum" from the "enumRef" name in "attribute".
I'm using the following:
<xsl:template match="enumRef">
<xsl:value-of select="@name"/>
<xsl:apply-templates select="//enum[@name ='ABC']">
<xsl:apply-templates select="//enum[@name='{attribute::@name}' ]">
</xsl:apply-templates>
</xsl:template>
What is the correct syntax to match an element using an attribute ["name" in this case] generically?
many thanks,
gb
|