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

Answer Posted / guest

Successful candidates should recognize this as one of the
most basic applications of XSLT. If they are not able to
construct a reply similar to the example below, they should
at least be able to identify the components necessary for
this operation: 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.

Extract Attributes from XML Data

Example 1.

<xsl:template match="element-name">

Attribute Value:

<xsl:value-of select="@attribute"/>

<xsl:apply-templates/>

</xsl:template>

Is This Answer Correct ?    11 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the advantages of using xml?

638


Which was the first processor related to XSLT?

718


What do xml editors check?

653


What is the xslt? : xslt

640


What is xml document?

645


Can I use the getattribute() and setattribute() methods of version 2.2 of the java servlet api to parse xml documents?

692


Can we do sorting in XSL ? how do you deal sorting columns dynamically in XML.

2611


What is html xml css?

638


What is xml designed for?

625


How use xml data in excel?

630


How does xslt transform xml?

637


What is excel xml format?

657


Why do people use xml?

695


What are possible ways XML used in j2ee WebApplication.Like storing data in to database and for data transfer .Apart from this any uses.

2124


Is xml used today?

628