View Single Post
  #3 (permalink)  
Old May 24th, 2006, 06:12 AM
cristtiah cristtiah is offline
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i have this code

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:asp="remove">
    <xsl:output method="html" />
    <xsl:key name="b" match="Field/@label" use="." />
    <xsl:key name="c" match="Field/@value" use="." />

    <xsl:key name="x" match="Field/@label" use="generate-id((self::Field[@pos='top']|following-sibling::Field[@label='End'])[last()])"/>

    <xsl:template match="/">
        <xsl:apply-templates />
    </xsl:template>
    <xsl:template match="Form/Pages/Page">
        <table>
            <xsl:apply-templates select="Fields" />
        </table>
    </xsl:template>

    <xsl:template match="Fields">
        <tr>
            <xsl:for-each select="Field[@pos='top']">
                    <td>
                        <xsl:copy-of select="key('x',generate-id())"/>
                    </td>
            </xsl:for-each>

        </tr>
    </xsl:template>



and xml


<?xml version="1.0"?>
<Form>
    <Pages>
        <Page>
            <Fields>
                <Field type="Separator" label="none" title="Accounts Setup" pos="top"/>
                <Field type="TextBox" label="one" value="- 1" />
                <Field type="TextBox" label="two" value="- 2" />
                <Field type="TextBox" label="three" value="- 3" />
                <Field type="End" label="End" />
                <Field type="Separator" label="none" title="Investment" pos="top" columns="2"/>
                <Field type="TextBox" label="four" value="- 4"/>
                <Field type="TextBox" label="five" value="- 5"/>
                <Field type="End" label="End" />
            </Fields>
        </Page>
    </Pages>
</Form>


I need to get the nodes between the type=separator and type=End and put them in a table like this

<table>
<tr>
<td>one</td>
<td>two</td>
<td>three</td>
</tr>
<tr>
<td>- 1</td>
<td>- 2</td>
<td>- 3</td>
</tr>
</table>
<table>
<tr>
<td>four</td>
<td>five</td>
</tr>
<tr>
<td>- 4</td>
<td>- 5</td>
</tr>
</table>


thanks.....