Explain how to rename a particular element and attribute from XML using XSL?

Submitted by: Muhammad
Renaming attribute is also similar to removing or deleting attribute as discussed in XSLT question 1, but instead of not doing anything when an attribute matches, you need to create an attribute and copy value of current attribute into new attribute. Identity template will be same and you need to add another template for renaming attribute using XSL:

<xsl:template match="@id">
<xsl:attribute name="emp_id">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:template>

if you are using XSLT 2.0 than instead of separate <xsL:value-of> element you can use select attribute directly with <xsL:attribute> as shown below

<xsl:attribute name="emp_id" select=".">
Submitted by: Muhammad

Read Online XSLT Job Interview Questions And Answers