Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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
 
Old November 23rd, 2006, 08:27 AM
Authorized User
 
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Hannibal
Default 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..
 
Old November 23rd, 2006, 08:38 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
 
Old November 23rd, 2006, 09:05 AM
Authorized User
 
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Hannibal
Default

I needed to group the datas in the way i had provided, although there is no relationship between the 2 tables,

 
Old November 23rd, 2006, 09:21 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
 
Old November 23rd, 2006, 09:26 AM
Authorized User
 
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Hannibal
Default

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.

 
Old November 23rd, 2006, 11:06 PM
Authorized User
 
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Hannibal
Default

can anyone please help

 
Old November 24th, 2006, 12:26 AM
Authorized User
 
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Hannibal
Default

I need the xslt for providing a report only. So there is no need for the relationships to check. Can anybody please help

 
Old November 24th, 2006, 02:08 AM
Authorized User
 
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Hannibal
Default

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

 
Old November 24th, 2006, 03:55 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

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)
 
Old November 24th, 2006, 04:24 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
PDF to XML conversion bcogney XSLT 7 September 21st, 2011 06:27 AM
string to binary conversion in XSLT navi25584 XSLT 5 September 3rd, 2008 03:14 AM
XSLT conversion question jastao XSLT 3 April 29th, 2008 09:09 PM
Very confused on XML to XML conversion mal141 XSLT 2 August 11th, 2006 02:44 AM
XSLT unix timestamp conversion Weezel XSLT 2 January 28th, 2005 02:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.