0
votes

I'm in process of creating XSLT transformation. My source XML contains element Order with attribute InstrumentType:

<Order InstrumentType="FWD">

Now, as part of transformation process I have to use the attribute value in condition like:

<xsl:if test="$InstrumentType='SPOT'">
...
</xsl:if>

I'm looking for some way to get the attribute value into InstrumentType variable in XSLT. Will appreciate your help.

1
Why do you need a variable? Can't you just use @InstrumentType directly? - Tomalak
<xsl:variable name="InstrumentType" select="@InstrumentType" /> - JLRishe
I tried using @InstrumentType but i'm not getting a value of the attribute. When debugging I see value type item(). Any other suggestions or i'm missing something? - Yaronin

1 Answers

0
votes

Maybe you have default namespace problem. Then you can use

<xsl:if test="@*[local-name()='InstrumentType' and .='SPOT']"></xsl:if>