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 is cdata in xml?

473


Do you feel that you are a good xslt programmer? : xslt

445


Define complex element?

477


how to transform an XML file into HTML using XSL transformation (XSLT)?

485


Can you use the xslt to convert html into vxml? : xslt

508






How does xml handle white-space in my documents?

502


What is the difference between a podcast and a rss?

440


Is xml schema required?

479


What is xml document?

468


What is an xml instance?

548


How do I save a xml file?

442


Why xml is needed?

465


Explain the classes in System.XML Namespace?

484


What language does xml use?

469


How many types of dtd are there in xml?

468