Subject: Re: [xsl] Re: Problem with Muenchian grouping From: jean pujol <jean.pujol@xxxxxxxxxxxxxxx> Date: Wed, 12 Nov 2003 09:39:02 +0100 |
Yes you are absolutely right I had a wrong idea of the problem. Here is a complete XML sample: ************************************ <dump> <identification> <version>1.0</version> <date>17/04/2003</date> </identification> <data> <project eiac="PISCINE"> <eiac>PISCINE</eiac> <lotnum>Lot 1</lotnum> <contractnum>0011</contractnum> <lcnstructure>11222333</lcnstructure> <projectpricecoef>0.000</projectpricecoef> <projectpricecur>EUR</projectpricecur> <totalsystems>1</totalsystems> <xafree1>REF LSA</xafree1> <xafree2>Rev</xafree2> <xafree10>ED1</xafree10> </project> <breakdown eiac="PISCINE" lcn="P1AA00XX" alc="00"> <action>delete</action> <eiac>PISCINE</eiac> <lcn>P1AA00XX</lcn> <alc>00</alc> <lcntype>P</lcntype> <uoc1>PS1</uoc1> <xbfree1>ED1</xbfree1> <xbfree2>E</xbfree2> </breakdown> <breakdown eiac="PISCINE" lcn="P1AA00XX001" alc="00"> <action>delete</action> <eiac>PISCINE</eiac> <lcn>P1AA00XX001</lcn> <alc>00</alc> <lcntype>P</lcntype> <breakramind>Y</breakramind> <uoc1>PS1</uoc1> <uoc2>PS2</uoc2> <xbfree1>ED1</xbfree1> <xbfree2>F</xbfree2> </breakdown> <breakdown eiac="PISCINE" lcn="P1AA01AB" alc="01"> <action>delete</action> <eiac>PISCINE</eiac> <lcn>P1AA01AB</lcn> <alc>01</alc> <lcntype>P</lcntype> <breakramind>Y</breakramind> <uoc1>PS2</uoc1> <xbfree1>ED1</xbfree1> <xbfree2>E</xbfree2> </breakdown> <breakdownlanguage eiac="PISCINE" lcn="P1AA00" alc="01" language="FR"> <eiac>PISCINE</eiac> <lcn>P1AA00</lcn> <alc>01</alc> <lcntypexb1>P</lcntypexb1> <language>FR</language> <lcnnom>S_SYST FILTRATION</lcnnom> <lcnnomfull>S_SYST FILTRATION</lcnnomfull> </breakdownlanguage> <breakdownlanguage eiac="PISCINE" lcn="P1AA00XX003" alc="01" language="FR"> <action>delete</action> <eiac>PISCINE</eiac> <lcn>P1AA00XX003</lcn> <alc>01</alc> <lcntypexb1>P</lcntypexb1> <language>FR</language> </breakdownlanguage> <breakdownlanguage eiac="PISCINE" lcn="P1AA00XX" alc="00" language="EN"> <action>delete</action> <eiac>PISCINE</eiac> <lcn>P1AA00XX</lcn> <alc>00</alc> <lcntypexb1>P</lcntypexb1> <language>EN</language> <lcnnom>ALIMENTATION EAUX</lcnnom> <lcnnomfull>ALIMENTATION EAUX</lcnnomfull> </breakdownlanguage> </data> </dump> ******************************************************** Usually my input XML files are much bigger but this one is a good example. The <action> elements all have the value "delete" but this is not a problem. There are two groups (I'm only interested in the children of <data> that have <action> elements): breakdown and breakdownlanguage. I repeat that I need, for each of both groups, to build an HTML table. To set the headers of those tables, I must get all possible children of a category (the children differ from one member of a group to another, but a member has only one child of a certain kind). Then the tables are filled with the textnode values of those children (a field can be blank if there is no child of a certain category). (But then, in a way, I must pay attention to the order of the headers). If someone could show me how nested grouping works, using the Muenchian method... Thanks in advance, Jean Dimitre Novatchev a écrit : > > I group elements that have an <action> child by name and then for each > group I > > build an HTML table. Members of the same group usually have the same set > of > > childnodes, but this is not always the case, and this is a problem, given > the > > way I build the tables: I get the first member of the group and set the > > headers of the table to the names of its children (<th align="center" > > bgColor="lightgrey"><xsl:value-of select="name()"/> </th>). When other > members > > of the group have more children, the values of those latter are put in a > new > > column without header... > > > > So, instead of getting the first member of the group, I would like to get > the > > one with the greatest number of children (to get all the headers, it's not > a > > problem if some fields are blank in the table). Is this possible? > > This is possible, but you have a wrong idea about the problem. Even if you > use the element with biggest number of children, there might be other > elements in the same group that have children, whose name will not be > represented in the column header. > > What you really need is all different names of all children of all elements > in a group. > > This is nested grouping and has a standard solution using the same Muenchian > method. > > Please, give a minimal complete example of a source xml document and many > people in this group will be glad to provide the solution. > > ===== > Cheers, > > Dimitre Novatchev. > http://fxsl.sourceforge.net/ -- the home of FXSL > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Problem with Muenchian gr, Dimitre Novatchev | Thread | [xsl] Outline a header, Barry van Weldam |
RE: [xsl] Flow data in table, Andreas L. Delmelle | Date | [xsl] Getting the value of ancestor, asim |
Month |