XSLT (XSL Transformations) Question:

Explain how to retrieve value of an attribute for an element using XSLT?

Tweet Share WhatsApp

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>

Download XSLT PDF Read All 31 XSLT Questions
Previous QuestionNext Question
What is XSL template? What output this XSL template will produce given a particular xml file?How to generate dynamic HTML pages from relational database using XSLT?