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 the use of xslt element?

654


How do I download a podcast from patreon?

638


What is the difference between DOM & SAX parsers ?

742


Can you open xml in excel?

687


Where can I find my rss feed on wordpress?

629


What is XSLT stylesheet?

736


How do I run an xsd file?

802


Do I have to know html or sgml before I learn xml?

615


Do xml namespaces apply to entity names, notation names, or processing instruction targets?

811


Do you feel that you have chosen the right technology xslt? : xslt

632


Tell me can we use graphics in xml?

717


Who can create an xml namespace?

692


Where can I declare an xml namespace?

730


Are atom feed files xml documents?

732


What are the ways to add styles to html?

635