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 components of xml?

531


How do I view an xml file?

524


How do I display an rss feed on my website?

544


What is a Processing Instruction in XML?

557


Do xml namespace declarations apply to dtds?

582






What is mean by xsl?

536


How many document types are defined for atom feed files?

505


What are the three main characteristics of xml?

542


Write a program that shows the elements of the stylesheets?

523


What is dtd ( document type definition )?

547


Why XML editor is needed instead of Notepad?

696


Use of CSS in XML document?

604


How do I find rss feeds?

560


What are the differences between HTML and XML?

564


What is xsl used for?

556