|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Add values to table
<?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@xxxxxxxxxx - email
-----Original Message-----
From: James Steven <JSteven@xxxxxxxxxxxxxxxxxxxxx>
Sent: Wed, 8 Sep 2004 15:41:00 +0100
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: 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>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








