 |
| XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

November 23rd, 2006, 08:27 AM
|
|
Authorized User
|
|
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
XML to XSLT conversion??
Hi..
I have a xml document. Document is as follows:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<Resource>
<Catalog>
<TableName>Mine</TableName>
<Column1>Blue</Column1>
<Column2>Red</Column2>
<Column3>Green</Column3>
<Query>Select </Query>
<Condition>all</Condition>
<Association_rule>1</Association_rule>
</Catalog>
<Catalog>
<TableName>Others</TableName>
<Column1>white</Column1>
<Column2>orange</Column2>
<Query>Insert</Query>
<Condition>= </Condition>
<Association_rule>2</Association_rule>
</Catalog>
</Resource>
I need to create a XSLT for this page. The problem is that the first table has 3 colums and second table has 2 columns.. How to create the xslt for the above?
eg: XSLT should be in this table format:
Table Columns Query Condition Association Rule
Mine Blue select all 1
Red insert = 2
Green
Others White
Orange
please help with the XSLT..
|
|

November 23rd, 2006, 08:38 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
Sorry, I don't understand the relationship of the input to the output. Why does the row for "Red", which appears to be part of table "Mine", fetch data from Table "Others", and why are the rows for "Others" blank?
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|

November 23rd, 2006, 09:05 AM
|
|
Authorized User
|
|
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
I needed to group the datas in the way i had provided, although there is no relationship between the 2 tables,
|
|

November 23rd, 2006, 09:21 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
Unless you can provide a clear specification of your requirements, there's no point starting to write code.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|

November 23rd, 2006, 09:26 AM
|
|
Authorized User
|
|
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
The xslt output format should have the tables and their respective columns. However the next element, ie., the query,condition and the Association rule should be sequentially following. This xslt conversion is provided as a Report, so there is no need for the relationships. Hope you can help me now.
|
|

November 23rd, 2006, 11:06 PM
|
|
Authorized User
|
|
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
can anyone please help
|
|

November 24th, 2006, 12:26 AM
|
|
Authorized User
|
|
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
I need the xslt for providing a report only. So there is no need for the relationships to check. Can anybody please help
|
|

November 24th, 2006, 02:08 AM
|
|
Authorized User
|
|
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
I have created a xslt, but its not providing the output i required. This is the XSLT that i have created:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Table</th>
<th align="left">Columns</th>
<th align="left">Query</th>
<th align="left">Condition</th>
<th align="left">Association Rule</th>
</tr>
<xsl:for-each select="Resource/Catalog">
<tr>
<td><xsl:value-of select="TableName"/></td>
<td><xsl:value-of select="Column1"/></td>
<td><xsl:value-of select="Query"/></td>
<td><xsl:value-of select="Condition"/></td>
<td><xsl:value-of select="Association_rule"/></td>
</tr>
<tr>
<td></td>
<td><xsl:value-of select="Column2"/></td>
</tr>
<tr>
<td></td>
<td><xsl:value-of select="Column3"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
I need the output as, i had shown in my first post. please do help
|
|

November 24th, 2006, 03:55 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
It's still very difficult to see how the data maps from your input to the output. Why does the red row have insert and = and the green row have neither?
--
Joe ( Microsoft MVP - XML)
|
|

November 24th, 2006, 04:24 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
No-one can write code for you unless you make the specification clear. You have not yet responded to the questions that Joe and I have asked.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|
 |