This discussion is archived
8 Replies Latest reply: Jan 9, 2013 12:51 PM by dvohra21 RSS

Problem in transforming xml data to HTML

Uva Newbie
Currently Being Moderated
Hai all,

I am new to J developer, I have generated XML data to transform to HTML.

Below is my xsql file with the name 'simpleqry.xsql'

<?xml version='1.0' ?>
<page xmlns:xsql="urn:oracle-xsql" connection="java:comp/env/jdbc/testDS">
<xsql:query max-rows="-1" tag-case="lower" null-indicator="no">SELECT EMPNO,ENAME,SAL FROM EMP WHERE SAL &gt;= 5000</xsql:query>
</page>

it is producing the XML datas

Further I need to convert it into HTML

so I generated xsl stylesheet in under META-INF with the name 'EmpDetails.xsl'

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="ISO-8859-1" method="text/html" />
<xsl:template match="/page">
<html>
<head>
<title>Employee Results</title>
</head>
<body>
<H2> EMPLOYEE QUERY RESULTS</H2>
<h5><em> Following demonstrates XSQL query</em></h5>
<table border="1" cellspacing="1" align="center">
<tr bgcolor=" #F9F0C1">
<th>EMP ID</th>
<th>EMPLOYEE NAME</th>
<th>SALARY</th>
</tr>
<xsl:for-each select="ROWSET/ROW">
<tr>
<td><xsl:value-of select="EMPNO"/></td>
<td><xsl:value-of select="ENAME"/></td>
<td><xsl:value-of select="SAL"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

next I have added the following to simpleqry.xsql

<?xml-stylesheet type="text/xsl" href="EmpResults.xsl" ?>

so my simpleqry.xsql file look like this

<?xml version='1.0' ?>
<?xml-stylesheet type="text/xsl" href="C:\JDeveloper\mywork\Application1\querysql\public_html\WEB-INF\EmpDetails.xsl" ?>
<page xmlns:xsql="urn:oracle-xsql" connection="java:comp/env/jdbc/testDS">
<xsql:query max-rows="-1" tag-case="lower" null-indicator="no">SELECT EMPNO,ENAME,SAL FROM EMP WHERE SAL &gt;= 5000</xsql:query>
</page>


when I rerun my simpleqry.xsql file it not generating the output .

My J developer version is 'Oracle IDE 11.1.2.0.38.60.17'

I know I made it lengthy. I made it clear so that you can understand my problem clearly. Please explain me how to solve the above mentioned problem(To generate HTML from XML data)

Thanks in advance.
Regards,
Uraja

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points