How to get tag value from input XML where tag name is stored in a variable



My code was unable to return a value from the input XML. The variable name is mapped in a separate xml based on a string.


Step 1: I need to extract the XML tag from the another mapping XML. (This I got it)


Step 2: XML tag is saved in a variable and using the root tag, I am not able to get the value


This is the XSLT:



<xsl:template match="SUBSCRIBER">

<xsl:variable name="expiry_date" select="$docStringAccountMapping/STRING_ACCOUNTS_LIST/STRING_ACCOUNTS_INFO[NSN_STRING='ThirdAccount']/AEXPIRY_DATE"/>

<!-- this returns a string "EXPIRY_DATE_1" -->

<xsl:value-of select="SUBSCRIBER/$expiry_date"/>


</xsl:template>


This is the XML:



<SUBSCRIBER>
<EXPIRY_DATE_1>2014-07-09 23:59:59</EXPIRY_DATE_1>
</SUBSCRIBER>

No comments:

Post a Comment