xsl-list
[Top] [All Lists]

[xsl] table formating

2011-01-26 07:50:58
Hi, 

Again This have to ask you people for help because I'm stuck. 

This is an abstract of what my input looks like:

<row>
    <cell>
     <absatz>Sozialversicherung (1.650,00 * 18,07 %)</absatz>
    </cell>
    <cell index="3"> </cell>
    <cell> </cell>
    <cell index="6">
     <absatz>298.16</absatz>
    </cell>
</row>

So the index of a <cell> says what its position in a <row> should be.
My desired output is:

<row>
    <cell>
     <absatz>Sozialversicherung (1.650,00 * 18,07 %)</absatz>
    </cell>
    <cell></cell>
    <cell index="3"> </cell>
    <cell> </cell>
    <cell></cell>
    <cell index="6">
     <absatz>298.16</absatz>
    </cell>
</row>

NOTE: It's not sure that there are always 2 cells with @index. Could be
more or less too.

I've tried this:
<xsl:template match="cell[@index]">
  <xsl:variable name="prec_cells"
select="xs:integer(count(preceding-sibling::cell[not(@index)]) +
sum(preceding-sibling::cell/@index))"/>
                
        <xsl:for-each select="1 to xs:integer((@index - 1) -
$prec_cells)">
                <entry>
                        <absatz/>
                </entry>
        </xsl:for-each>
                <entry>
                        <xsl:apply-templates/>
                </entry>
</xsl:template>

Unfortunately this only works for 1 <cell> with @index per <row>.

Can anyone tell me how to solve that ?!

Kind regards

. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick(_dot_)szabo(_at_)lexisnexis(_dot_)at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 






--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>