Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: How would we get xml tags in xsl if we have same element name >Thread Next - Re: How would we get xml tags in xsl if we have same element name Re: How would we get xml tags in xsl if we have same element nameTo: NULL Date: 7/12/2007 11:44:00 AM "Martin Honnen" wrote: > kamkaro wrote: > > > output: > > Title: Redundant Group > > Identifier = Q9D6L8 > > db = dbj > > Title: Database Cross-references > > Identifier = Z98T23 > > db = GENE > > Here is an XSLT 1.0 stylesheet that transforms each field element into a > HTML table: > > <xsl:stylesheet > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > > <xsl:output method="html" indent="yes"/> > > <xsl:template match="/"> > <html lang="en"> > <head> > <title>Example</title> > </head> > <body> > <xsl:apply-templates/> > </body> > </html> > </xsl:template> > > <xsl:template match="field"> > <table> > <tbody> > <tr> > <th>Title:</th> > <td><xsl:value-of select="title"/></td> > </tr> > <tr> > <th>Identifier = </th> > <td><xsl:value-of > select="content/table/row/cell/idebtifier"/></td> > </tr> > <tr> > <th>db = </th> > <td><xsl:value-of select="content/table/row/cell/db"/></td> > </tr> > </tbody> > </table> > </xsl:template> > > </xsl:stylesheet> > > So what you are looking for is just a template matching field elements > and then in that template you can construct whatever output you need for > those elements and their descendant elements. > > > > -- > > Martin Honnen --- MVP XML > http://JavaScript.FAQTs.com/ > Hi Martin, My question is still there, i have two 'filed' in my xml and according to your reply " <xsl:template match="field">" how do i know which field is calling ?? I do know if we have different parent name so i can give path expression but if we have same parents name so how would we do it, plz explain me. thanks in advance. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
