Re: [xsl] Diff table for spotted nodes

Subject: Re: [xsl] Diff table for spotted nodes
From: Jörg Heinicke <joerg.heinicke@xxxxxx>
Date: Mon, 26 Nov 2001 21:10:04 +0100
Hi Yan,

I assume that you want to create a new table for each test-row without
another elements between them. So you must select all test-elements, where
the precedessor is not test.

<xsl:template match="doc_root">
    <xsl:apply-templates select="test[name(preceding-sibling::*[1])!=
'test']" mode="table"/>

Now you create the table and apply the same test-element again for creating
the first tablerow.

<xsl:template match="test" mode="table">
        <xsl:apply-templates select="." mode="tablerow"/>

The last template creates for the first and all directly following
test-elements a tablerow.

<xsl:template match="test" mode="tablerow">
        <td><xsl:value-of select="text()"/></td>
    <xsl:apply-templates select="following-sibling::*[1][name()='test']"

Hope this helps,


----- Original Message -----
From: "yan bai" <bytj@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, November 26, 2001 4:12 PM
Subject: [xsl] Diff table for spotted nodes

> Gurus,
> I've tries this many times, but with no result.
> I have an .xml file which contains the following
> element.
> <doc_root>
> ...
> <test>Value 1</test>
> <test>Value 2</test>
> <test>Value 3</test>
> <test>Value 4</test>
> <other>Other value</other>
> <another>another value</another>
> <test>Value 5</test>
> <test>Value 6</test>
> ....
> </doc_root>
> I need to transform them into a html page.  Here,
> all adjacent <test> nodes should be put into one
> table.
> Thus, in this case, Value 1, Value 2, Value 3, Value 4
> have to be in one table.   Value 5 and Value 6 should
> be in another table.
> Any one can help?
> Yan
> __________________________________________________
> Do You Yahoo!?
> Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
>  XSL-List info and archive:

 XSL-List info and archive:

Current Thread