Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Using XSLT, how could we extract a specific attribute from an element in an XML document?

user-image
Question added by Mohammed Shaban , Senior software engineering , Thiqah
Date Posted: 2016/02/14
Darshan Wadhwani Wadhwani
by Darshan Wadhwani Wadhwani , Junior Software Developer

By providing xPath of the element and using @ followed by the attribute name.

santoshreddy allala
by santoshreddy allala , Team leader , softview RAR IT solutions

Using Acrobat professional and epsilon editor

Deleted user
by Deleted user

If they are not able toconstruct a reply similar to the example below, they shouldat least be able to identify the components necessary forthis operation: xsl:template to match the appropriate XMLelement, xsl:value-of to select the attribute value, and theoptional xsl:apply-templates to continue processing thedocument.Extract Attributes from XML Data Example 1.<xsl:template match="element-name">Attribute Value:<xsl:value-of select="@attribute"/><xsl:apply-templates/></xsl:template> 

 

 

 

or

 

 

 

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.

More Questions Like This