Thursday, 24 January 2019

How to retrieve value of an attribute for an element using XSLT

How to retrieve value of an attribute for an element using XSLT?

Answer:

This XSLT interview question is pretty common in many XML interviews as well. If candidate has worked in XSLT then this is a fairly easy question as it just need to come up with a XSLT template which can copy an attribute from an element like below:
<xsl:template match="/employees/employee">
Value of attribute Id is :
<xsl:value-of select="@id"></xsl:value-of>

</xsl:template>

No comments:

Post a Comment