[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Diff table for spotted nodes

Subject: Re: Diff table for spotted nodes
From: Jörg Heinicke <joerg.heinicke@xxxxxx>
Date: Mon, 26 Nov 2001 21:10:04 +0100
diff table
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"/>
</xsl:template>

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

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

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

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

Hope this helps,

Joerg

----- Original Message -----
From: "yan bai" <bytj@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, November 26, 2001 4:12 PM
Subject:  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.
> http://geocities.yahoo.com/ps/info1
>
>  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.