xslt - how to get required tag value from an xml file in .xsl file? -


i have following type of file contains in xml format

<?xml version="1.0" encoding="utf-8"?> <root>     <serviceimpl category="default">         <package>estermemorymanagement</package>         <service singleton="true">             <provides>xoc.hw.cor.memgt.zcontenttype</provides>             <brief>this sis first sdrevice</brief>         </service>     </serviceimpl>     <serviceimpl category="default">         <package>w.cor.testerm</package>         <service singleton="true">             <provides>xoc.hw.zaccesstypeprovid</provides>             <brief>this sis first sdrevice</brief>         </service>     </serviceimpl> </root> 

i have values within tag <provides></provides> in .xsl file. how can that? in advance.

here's 1 way of doing it:

<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform"     version="1.0">      <xsl:output method="text"/>      <xsl:template match="root">         <xsl:apply-templates select="serviceimpl"/>     </xsl:template>      <xsl:template match="serviceimpl">         <xsl:apply-templates select="service"/>         <xsl:text>,</xsl:text>     </xsl:template>      <xsl:template match="service">         <xsl:apply-templates select="provides"/>     </xsl:template>      <xsl:template match="provides">         <xsl:value-of select="."/>     </xsl:template>  </xsl:stylesheet> 

you may want have @ this question, , related answers.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -