XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Kevin SnyderSubject: Two HTML Tables , Two XML Files, One XSLT file ???
Author: Kevin Snyder
Date: 28 Feb 2006 10:23 PM
I don't know how to solve this problem and so far know one else has either, help...........

Goal: A single HTML with two seperate tables using two seperate XML sources. Simply one table per one XML...??

I have one DataSet.xsd with two tables and two .xml files, each table has it's own seperate xml.

DataSet1.xsd ------- datatable1 ---- datatable1.xml
^------- datatable2 ---- datatable2.xml


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:tbl="http://tempuri.org/DataSet1.xsd" exclude-result-prefixes="tbl">

<xsl:template match="/">
<html>
<head>
<title>Customers</title>
</head>
<body>
<h1 style=" font-family:arial; font-size:12pt; font-weight:bold; text-align:left;">Customers:</h1>
<table border="1" style="width:100%">
<thead>
<tr style =" font-family:arial; font-size:10pt; font-weight:bold; text-align:center; background-color:FAF8CC; cell-padding:10px">
<td>Date/Time</td>
<td>First Name</td>
<td>Last Name</td>
<td>Gender</td>
<td>Age</td>
</tr>
</thead>
<xsl:apply-templates/>
<p></p>
</table>

<h1 style=" font-family:arial; font-size:12pt; font-weight:bold; text-align:left;">Jobs:</h1>
<table border="1" style="width:100%">
<thead>
<tr style =" font-family:arial; font-size:10pt; font-weight:bold; text-align:center; background-color:FAF8CC; cell-padding:10px">
<td>Date/Time</td>
<td>Current</td>
<td>Past</td>
</tr>
</thead>
<xsl:apply-templates select="document('tableinfo.xml')//DataSet1"/>
</table>
</body>
</html>
</xsl:template>

<xsl:template match="tbl:tablecustomers">
<tr style =" font-family:arial; font-size:10pt; font-weight:normal; text-align:left; background-color:FFFFFF; cell-padding:10px">
<td>
<xsl:value-of select="tbl:datetime"/>
</td>
<td>
<xsl:value-of select="tbl:firstname"/>
</td>
<td>
<xsl:value-of select="tbl:lastname"/>
</td>
<td>
<xsl:value-of select="tbl:gender"/>
</td>
<td>
<xsl:value-of-select="tbl:age"/>
<td>
</tr>
</xsl:template>

<xsl:template match="tbl:primarykey"/>


<xsl:template match="tbl:tableinfo">
<tr style =" font-family:arial; font-size:10pt; font-weight:normal; text-align:left; background-color:FFFFFF; cell-padding:10px">
<td>
<xsl:value-of select="tbl:datetime"/>
</td>
<td>
<xsl:value-of select="tbl:current"/>
</td>
<td>
<xsl:value-of select="tbl:past"/>
</td>
</tr>
</xsl:template>
<xsl:template match="tbl:primarykey"/>
</template>

Postnext
Minollo I.Subject: Two HTML Tables , Two XML Files, One XSLT file ???
Author: Minollo I.
Date: 28 Feb 2006 10:50 PM
Your general approach looks fine from what I can see; you don't state what's going wrong for you.

Can you give us some more details, and attach (or email us, stylus-field-report@progress.com) the original XSLT and XML documents you are using so that we can help you in a more practical way?

Thanks,
Minollo

Postnext
Kevin SnyderSubject: Two HTML Tables , Two XML Files, One XSLT file ???
Author: Kevin Snyder
Date: 01 Mar 2006 11:43 AM
I've made life much easier by merging the two seperate XML files into one(tablecustomerscombo.xml) found below.

Using my first post XSLT example (excluding the select="document('') code), I recieve an HTML that has two seperate HTML tables (one below the other), however both contain the entire XML data instead of seperatly.

I need the first HTML table to include only 'tablecustomers' data and the second HTML table to include only 'tableinfo' data.

[tablecustomerscombo.xml]
<?xml version="1.0" standalone="yes"?>
<DataSet1 xmlns="http://tempuri.org/DataSet1.xsd">
<tablecustomers>
<id>1</id>
<datetime>2006-02-12T22:18:30-05:00</datetime>
<userfirst>Mike</userfirst>
<userlast>Jones</userlast>
<gender>male</gender>
<age>55</age>
</tablecustomers>
<tablecustomers>
<id>2</id>
<datetime>2006-02-12T22:18:35-05:00</datetime>
<userfirst>Joe</userfirst>
<userlast>Smith</userlast>
<gender>male</gender>
<age>31</age>
</tablecustomers>
<tableinfo>
<id>1</id>
<datetime>2006-02-12T22:18:41-05:00</datetime>
<current>true</current>
<past>false</current>
</tableinfo>
<tableinfo>
<id>2</id>
<datetime>2006-02-12T22:19:21-05:00</datetime>
<current>true</current>
<past>true</current>
</tableinfo>


Postnext
Minollo I.Subject: Two HTML Tables , Two XML Files, One XSLT file ???
Author: Minollo I.
Date: 01 Mar 2006 12:47 PM
You need to tune the two xsl:apply-templates instructions responsible for filling your tables...

<table border="1" style="width:100%">
<thead>
<tr style=" font-family:arial; font-size:10pt; font-weight:bold; text-align:center; background-color:FAF8CC; cell-padding:10px">
<td>Date/Time</td>
<td>First Name</td>
<td>Last Name</td>
<td>Gender</td>
<td>Age</td>
</tr>
</thead>
<xsl:apply-templates select="//tbl:tablecustomers"/>
<p></p>
</table>

<h1 style=" font-family:arial; font-size:12pt; font-weight:bold; text-align:left;">Jobs:</h1>
<table border="1" style="width:100%">
<thead>
<tr style=" font-family:arial; font-size:10pt; font-weight:bold; text-align:center; background-color:FAF8CC; cell-padding:10px">
<td>Date/Time</td>
<td>Current</td>
<td>Past</td>
</tr>
</thead>
<xsl:apply-templates select="//tbl:tableinfo"/>
</table>

Posttop
Kevin SnyderSubject: Two HTML Tables , Two XML Files, One XSLT file ???
Author: Kevin Snyder
Date: 01 Mar 2006 02:44 PM
Very cool, thank you......

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.