converting xml to xslt?  
Author Message
Musafir





PostPosted: XML and the .NET Framework, converting xml to xslt? Top

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..

please help...

I have created the XSLT file:

< xml version="1.0" encoding="ISO-8859-1" >

<xsl:stylesheet version="1.0"
xmlns:xsl=" http://www.hide-link.com/ ">


<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"> 
 <xsl:sort select="Associationj_rule"/>

<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>

But this is not providing the output that i wanted.. Can anyone please help...



.NET Development25  
 
 
Sergey Dubinets - MSFT





PostPosted: XML and the .NET Framework, converting xml to xslt? Top

You can put two separate xsl:for-each one after another.

<table>

<xsl:for-each selec="">

<tr>

<td>column 1</td><td>column 2</td><td>column 3</td><td>column 4</td><td>column 5</td>

</tr>

</xsl:for-each>

<xsl:for-each selec="">

<tr>

<td>column 1</td><td>column 2</td><td>column 3</td>

</tr>

</xsl:for-each>

</table>