<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="UTF-8" />
<xsl:template match="/root">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="Table">
<xsl:value-of select="@name" />
<xsl:text>
Column Value</xsl:text>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="Column">
<xsl:value-of select="@name" /><xsl:text>
</xsl:text><xsl:value-of select="./Value" />
</xsl:template>
</xsl:stylesheet>
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email
-----Original Message-----
From: James Steven <JSteven(_at_)redlinesoftware(_dot_)co(_dot_)uk>
Sent: Wed, 8 Sep 2004 15:41:00 +0100
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: [xsl] Add values to table
Hello
I have the following xml
<root>
<Table name="abc">
<Column name="987">
<Value>h</Value>
</Column>
<Column name="123">
<Value>a</Value>
</Column>
<Column name="456">
<Value>g</Value>
</Column>
</Table>
<Table name="ghi">
<Column name="jkl">
<Value>5</Value>
</Column>
</Table>
<Table name="mno">
<Column name="pqr">
<Value>7</Value>
</Column>
<Column name="1011">
<Value>p</Value>
</Column>
</Table>
<Table name="stu">
<Column name="vwx">
<Value>3</Value>
</Column>
</Table>
</root>
Using this I would like to create a table like that below:
abc
Column Value
987 h
123 a
456 g
ghi
Column Value
jkl 5
mno
Column Value
pqr 7
1011 p
stu
Column Value
vwx 3
To try and create this table I have used the xsl below but this only creates
the following:
abc
Column Value
ghi
Column Value
mno
Column Value
stu
Column Value
How can I adjust the xsl below to include values for Column and Value?
Thanks.
<xsl:template match="ROOT">
<xsl:for-each select="Table">
<fo:table-row>
<fo:table-cell>
<fo:block>
<xsl:value-of select="@name"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>
Column
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
Properties
</fo:block>
</fo:table-cell>
</fo:table-row>
<xsl:for-each select="Table/Column">
<fo:table-row>
<fo:table-cell>
<fo:block>
<xsl:value-of select="@name"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</xsl:for-each>
</xsl:template match>
--+------------------------------------------------------------------
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>
--+--