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

RE: Add values to table

Subject: RE: Add values to table
From: cknell@xxxxxxxxxx
Date: Wed, 08 Sep 2004 11:33:40 -0400
xsl template match column
<?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>

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.