Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: How would we get xml tags in xsl if we have same element name

From: kamkaro@-----------.---------.---
To: 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.




transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent