Quantcast
Channel: Adobe Community : Popular Discussions - FrameMaker Structured
Viewing all articles
Browse latest Browse all 66580

XSLT to convert XML into Tables

$
0
0

Hi,

 

I'm trying to import my XML data into a table format. After adding an XSL file to my Structure Application as a Preprocessing Stylesheet, and importing my XML instance file with the Template file opened, the "Unknown File Type" error window appeared asking for a file format to Convert From. Picking any one doesn't create a table.

 

The XSL file tranforms the XML data into an HTML file that has a table with columns corresponding to the XML data. I was thinking using that type of XSL because it renders tables.

 

Below is the XSL markup:

 

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

  <h2>Products</h2>

    <table border="1">

      <tr bgcolor="#9acd32">

        <th>Title</th>

        <th>Number</th>

        <th>Date</th>

      </tr>

      <xsl:for-each select="Products/Product">

      <tr>

        <td><xsl:value-of select="Title"/></td>

        <td><xsl:value-of select="Number"/></td>

        <td><xsl:value-of select="Date"/></td>

      </tr>

      </xsl:for-each>

    </table>

  </body>

  </html>

</xsl:template>

</xsl:stylesheet>

 

Title, Number, and Date are child elements of the Product element, which is a child element of the Products root element in my XML file.

 

Am I applying the stylesheet correctly here? Am I using the write kind of stylesheet?

 

Thanks,

zeb


Viewing all articles
Browse latest Browse all 66580

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>