Home > DeveloperSection > Interviews > Using XSLT, how would you extract a specific attribute from an element in an XML document?

Posted on    March-18-2011 12:00 AM

 XML XML 
Ratings:
 1 Answer(s)
  1492  View(s)
Rate this:

Dependra Pathak
Dependra Pathak

Total Post:77

Points:385
Posted on    March-18-2011 12:00 AM

Extract Attributes from XML Data
Example:
<xsl:template match=”element-name”>
Attribute Value:
<xsl:value-of select=”@attribute”/>
<xsl:apply-templates/>

</xsl:template>

 Note: xsl:template to match the appropriate XML element,
xsl:value-of to select the attribute value, and the optional
xsl:apply-templates to continue processing the document.


Don't want to miss updates? Please click the below button!

Follow MindStick