ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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

user-image
تم إضافة السؤال من قبل Mohammed Shaban , Senior software engineering , Thiqah
تاريخ النشر: 2016/02/14
Darshan Wadhwani Wadhwani
من قبل Darshan Wadhwani Wadhwani , Junior Software Developer

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

santoshreddy allala
من قبل santoshreddy allala , Team leader , softview RAR IT solutions

Using Acrobat professional and epsilon editor

مستخدم محذوف‎
من قبل مستخدم محذوف‎

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.

المزيد من الأسئلة المماثلة