Transform Inline Example
In this example, both the Xml and Xslt are inlined. The Xml shows a list of books and the Xslt transforms in into a nice Html table. The indent parameter is set to true for creating an easier to read output and the xml declaration is omitted.
| Smartsite SXML |
|
|---|---|
<se:transform>
<se:parameters>
<se:parameter name="xml">
<books>
<book author="Edsger W. Dijkstra" title="Writing a number as the sum of two squares." />
<book author="Andrew S. Tanenbaum" title="Computer Networks" />
</books>
</se:parameter>
<se:parameter name="xslt">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My collection of books</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Title</th>
<th align="left">Author</th>
</tr>
<xsl:for-each select="books/book">
<tr>
<td><xsl:value-of select="@title" /></td>
<td><xsl:value-of select="@author" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
</se:parameter>
</se:parameters>
</se:transform>
|
|
| Example Result |
|
|---|---|
<html>
<body>
<h2>My collection of books</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Title</th>
<th align="left">Author</th>
</tr>
<tr>
<td>Writing a number as the sum of two squares.</td>
<td>Edsger W. Dijkstra</td>
</tr>
<tr>
<td>Computer Networks</td>
<td>Andrew S. Tanenbaum</td>
</tr>
</table>
</body>
</html>
|
|