Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: XSLT conversion >Thread Next - Re: XSLT conversion Re: XSLT conversionTo: NULL Date: 4/26/2004 10:24:00 AM 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
> >
> >
>
>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
