How to remove a particular element from XML?
Answer:
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 element you can use select attribute directly with as shown below
<xsl:attribute name="emp_id" select=".">
No comments:
Post a Comment