Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

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

user-image
Question ajoutée par Mohammed Shaban , Senior software engineering , Thiqah
Date de publication: 2016/02/14
Darshan Wadhwani Wadhwani
par Darshan Wadhwani Wadhwani , Junior Software Developer

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

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

Using Acrobat professional and epsilon editor

Utilisateur supprimé
par Utilisateur supprimé

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