xsl-list
[Top] [All Lists]

[xsl] 2 columns with special conditions

2007-05-03 07:06:09
Hi,

i have a "little" problem.
I try to get a two column layout where all elements with type F live in
column one and elements with type C in column two. Special thing is that
you have watch the order. How can i achieve case 2 and 3?

Thanks in advance
Sven

xml:
case1:

<mc name="1" type="F"/>
<mc name="2" type="C"/>
<mc name="3" type="F"/>
<mc name="4" type="C"/>
<mc name="5" type="F"/>
<mc name="6" type="C"/>

=>
(first column always type F, second type C)

1       2
3       4
5       6

there is no problem, template works.


case2:

<mc name="1" type="C"/>
<mc name="2" type="C"/>
<mc name="3" type="F"/>
<mc name="4" type="C"/>
<mc name="5" type="F"/>
<mc name="6" type="C"/>

=>

-       1
-       2
3       4
5       6


case3:

<mc name="1" type="F"/>
<mc name="2" type="C"/>
<mc name="3" type="F"/>
<mc name="4" type="F"/>
<mc name="5" type="F"/>
<mc name="6" type="C"/>

=>

1       2
3       -
4       -
5       6

my xsl:
....
<xsl:template match="step">
        <xsl:for-each select="descendant::mc[position() mod 2 = 1]">
                <tr>
                        <td>
                                <xsl:value-of 
select="self::node()[(_at_)type='F']/@name"/>
                        </td>
                        <td>
                                <xsl:value-of 
select="following-sibling::node()[position()+1 and
@type='C']/@name"/>
                        </td>
                </tr>
        </xsl:for-each>
</xsl:template>
...

-- 
===============================================================
imbus AG, Kleinseebacher Str. 9, 91096 Möhrendorf, DEUTSCHLAND
Tel. +49 9131 7518-0, Fax +49 9131 7518-50
info(_at_)imbus(_dot_)de http://www.imbus.de

imbus AG, Unter der Linde 16, 80939 München, DEUTSCHLAND
Tel. +49 89 3219909-0, Fax +49 89 3219909-50
info(_at_)imbus(_dot_)de http://www.imbus.de

Vorsitzender des Aufsichtsrates: Hendrik Rässler
Vorstand: Tilo Linz, Bernd Nossem, Thomas Roßner, Jörg Schulten
Sitz der Gesellschaft: Möhrendorf, München
Registergericht: Fürth/Bay, HRB 8365
---------------------------------------------------------------
imbus Rhein-Main GmbH, Zanggasse 6, 65719 Hofheim, DEUTSCHLAND
Tel. +49 6192 92192-0, Fax +49 6192 92192-50
info(_at_)imbus(_dot_)de http://www.imbus.de

Geschäftsführer: Frank Schmeißner, Jörg Schulten
Sitz der Gesellschaft: Hofheim
Registergericht: Frankfurt am Main, HRB 52155 
===============================================================


--~------------------------------------------------------------------
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>