Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSLT conversion

From: "Olivier VEIT" <olivier.veit@----.-->
To: NULL
Date: 4/26/2004 10:29:00 AM
Sorry, were was i little mistake in the output I need. It is :

OUTPUT i Need :
 =================

 <?xml version="1.0" encoding="ASCII"?>
 <TEST>
     <ROW>
             <CELL COLSPAN="4">Mondial</CELL>
             <CELL COLSPAN="4">EEE</CELL>
             <CELL COLSPAN="4">Portugal</CELL>
     </ROW>
     <ROW>
             <CELL COLSPAN="2">Volume</CELL>
             <CELL COLSPAN="2">Quantité</CELL>
             <CELL COLSPAN="2">Volume</CELL>
             <CELL COLSPAN="2">Quantité</CELL>
             <CELL COLSPAN="2">Volume</CELL>
             <CELL COLSPAN="2">Quantité</CELL>
     </ROW>
     <ROW>
             <CELL>kg</CELL>
             <CELL>tonnes</CELL>
             <CELL>kg</CELL>
             <CELL>tonnes</CELL>
             <CELL>kg</CELL>
             <CELL>tonnes</CELL>
             <CELL>kg</CELL>
             <CELL>tonnes</CELL>
             <CELL>kg</CELL>
             <CELL>tonnes</CELL>
             <CELL>kg</CELL>
             <CELL>tonnes</CELL>
     </ROW>
 </TEST>


"Olivier VEIT" <olivier.veit@f...> a écrit dans le message de
news:c6igv0$nri$1@n......
> Hello,
>
> thanks, but your solution is only possible for this exemple. The
stylesheet
> should be dynamic and treat a undefined number of imbricated HD.C.
> The COLSPAN attribute should also be generated dynamically. I think the
only
> solution is to use recursion...but how ?
> Here, an other exemple :
>
> INPUT :
> =======
> <?xml version="1.0" encoding="UTF-8"?>
>
> <TEST>
>     <HEADER.COL>
>         <HD.C>Mondial
>                 <HD.C TYPE="INT">Volume
>                         <HD.C>kg</HD.C>
>                         <HD.C>tonnes</HD.C>
>                 </HD.C>
>                 <HD.C TYPE="INT">Quantité
>                     <HD.C>kg</HD.C>
>                     <HD.C>tonnes</HD.C>
>                 </HD.C>
>         </HD.C>
>         <HD.C>EEE
>                 <HD.C TYPE="INT">Volume
>                     <HD.C>kg</HD.C>
>                     <HD.C>tonnes</HD.C>
>                     </HD.C>
>                 <HD.C TYPE="INT">Quantité
>                     <HD.C>kg</HD.C>
>                     <HD.C>tonnes</HD.C>
>                 </HD.C>
>         </HD.C>
>         <HD.C>Portugal
>                 <HD.C TYPE="INT">Volume
>                             <HD.C>kg</HD.C>
>                         <HD.C>tonnes</HD.C>
>                 </HD.C>
>                 <HD.C TYPE="INT">Quantité
>                         <HD.C>kg</HD.C>
>                         <HD.C>tonnes</HD.C>
>                 </HD.C>
>         </HD.C>
>     </HEADER.COL>
> </TEST>
>
> OUTPUT i Need :
> =================
>
> <?xml version="1.0" encoding="ASCII"?>
> <TEST>
>     <ROW>
>             <CELL COLSPAN="4">Mondial</CELL>
>             <CELL COLSPAN="4">EEE</CELL>
>             <CELL COLSPAN="4">Portugal</CELL>
>     </ROW>
>     <ROW>
>             <CELL COLSPAN="2">Volume</CELL>
>             <CELL COLSPAN="2">Quantité</CELL>
>             <CELL COLSPAN="2">Volume</CELL>
>             <CELL COLSPAN="2">Quantité</CELL>
>             <CELL COLSPAN="2">Volume</CELL>
>             <CELL COLSPAN="2">Quantité</CELL>
>     </ROW>
>     <ROW>
>             <CELL>kg</CELL>
>             <CELL>tonnes</CELL>
>             <CELL>kg</CELL>
>             <CELL>tonnes</CELL>
>             <CELL>kg</CELL>
>             <CELL>tonnes</CELL>
>             <CELL>kg</CELL>
>             <CELL>tonnes</CELL>
>     </ROW>
> </TEST>
>
>
>
> "Han" <hp4444@k...> a écrit dans le message de
> news:ONThnxoKEHA.2576@T......
> > Try,
> >
> > <xsl:stylesheet
> >  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >  version="1.0">
> > <xsl:output method='xml' indent='yes' omit-xml-declaration='yes'/>
> >
> > <xsl:template match="/">
> > <TEST>
> >     <ROW>
> >         <CELL COLSPAN="2">Mundial</CELL>
> >         <CELL COLSPAN="2">EEE</CELL>
> >         <CELL COLSPAN="2">Portugal</CELL>
> >     </ROW>
> >     <ROW>
> >   <xsl:apply-templates select="//HD.C/HD.C"/>
> >  </ROW>
> > </TEST>
> > </xsl:template>
> >
> > <xsl:template match='HD.C'>
> >  <CELL>
> >  <xsl:value-of select='.'/>
> >  </CELL>
> > </xsl:template>
> >
> > </xsl:stylesheet>
> >
> > "Olivier VEIT" <olivier.veit@f...> wrote in message
> > news:c6b5bq$6fh$1@n......
> > > Hello All,
> > >
> > > I would like to write a stylesheet enbling me to get the end structure
> > from
> > > start structu.
> > >
> > > My start structure :
> > > ==============
> > > <TEST>
> > >     <HEADER.COL>
> > >         <HD.C>Mundial
> > >             <HD.C TYPE="INT">Volume 1</HD.C>
> > >             <HD.C TYPE="INT">Test 1</HD.C>
> > >         </HD.C>
> > >         <HD.C>EEE
> > >             <HD.C TYPE="INT">Volume 2</HD.C>
> > >             <HD.C TYPE="INT">Test 2</HD.C>
> > >         </HD.C>
> > >         <HD.C>Portugal
> > >             <HD.C TYPE="INT">Volume 3</HD.C>
> > >             <HD.C TYPE="INT">Test 3</HD.C>
> > >         </HD.C>
> > >     </HEADER.COL>
> > > </TEST>
> > >
> > > This is the end structure I would like to have :
> > > ======================================
> > > <TEST>
> > >     <ROW>
> > >         <CELL COLSPAN="2">Mundial</CELL>
> > >         <CELL COLSPAN="2">EEE</CELL>
> > >         <CELL COLSPAN="2">Portugal</CELL>
> > >     </ROW>
> > >     <ROW>
> > >         <CELL>Volume 1</CELL>
> > >         <CELL>Test 1</CELL>
> > >         <CELL>Volume 2</CELL>
> > >         <CELL>Test 2</CELL>
> > >         <CELL>Volume 3</CELL>
> > >         <CELL>Test 3</CELL>
> > >     </ROW>
> > > </TEST>
> > >
> > > The solution should be general so that it also works with multiple
HD.C
> > > imbrications.
> > >
> > > Thanks for your answers
> > >
> > > Have a nice Day
> > >
> > > Olivier
> > >
> > >
> >
> >
>
>




transparent
Print
Mail
Like It
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