Detail tables handled in XSLT, XSQL, ORACLE

Subject: Detail tables handled in XSLT, XSQL, ORACLE
From: "Rob Jagelski" <rjagelski@xxxxxxxxxxx>
Date: Mon, 30 Oct 2000 14:38:05 -0400 (EST)
Hello,

I'm new to XSL and have a question. How are detail records handled in XSL? I've found an example that works, but instead of inserting records into a database, it displays them as HTML. I thought that I could tweek the XSL file to write to my database instead, but I've been unsuccessful so far. I'm using an Oracle database and its XSQL java servlet. The example I'm trying to get to work is one that's shipped with Oracle's servlet. It's an employee/department demo with one master department record having many employee records. I ran the scripts Oracle sent and can successfully insert a record into my database from SQL Plus and TOAD. The problem occurs when I try to insert a record using XML and XSL. Following is the SQL statement that successfully inserted a record:

*****
insert into department values (5, 'Engineering', 'Portland', emp_list(emp_t(10, 'Bret', 25),emp_t(11, 'Steve', 27)));
*****


department is a view table and emp_list is a type of Employee table containing one or more emp_t records. emp_t is a type of Employee table record.

Following is the XSL document:

*****
<?xml version = '1.0'?>
<ROWSET xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xsl:version="1.0">

<xsl:for-each select="ROWSET/ROW">

 <ROW>
   <DEPTNO><xsl:value-of select="DEPTNO"/></DEPTNO>
   <DNAME><xsl:value-of select="DNAME"/></DNAME>
   <LOC><xsl:value-of select="LOC"/></LOC>
   <xsl:for-each select="EMPLOYEES/EMPLOYEES_ITEM">
     <EMPLOYEES>emp_list(emp_t(<xsl:value-of select="EMPNO"/>
     <xsl:value-of select="ENAME"/>
     <xsl:value-of select="SAL"/>))</EMPLOYEES>
   </xsl:for-each>
 </ROW>

</xsl:for-each>

</ROWSET>
*****

Following is the XML file:

<ROWSET>
 <ROW>
   <DEPTNO>99</DEPTNO>
   <DNAME>ACCOUNTING</DNAME>
   <LOC>NEW YORK</LOC>
   <EMPLOYEES>
      <EMPLOYEES_ITEM>
         <EMPNO>1111</EMPNO>
         <ENAME>CLARK</ENAME>
         <SAL>2450</SAL>
      </EMPLOYEES_ITEM>
      <EMPLOYEES_ITEM>
         <EMPNO>2222</EMPNO>
         <ENAME>KING</ENAME>
         <SAL>5000</SAL>
      </EMPLOYEES_ITEM>
      <EMPLOYEES_ITEM>
         <EMPNO>3333</EMPNO>
         <ENAME>MILLER</ENAME>
         <SAL>1300</SAL>
      </EMPLOYEES_ITEM>
   </EMPLOYEES>
 </ROW>
</ROWSET>
*****

Following is the XSQL file:

<?xml version='1.0'?>
<xsql:insert-request connection="rob" xmlns:xsql="urn:oracle-xsql"
 table="department" transform="address_insert2.xsl"/>
*****

Any help is very much appreciated since documentation is so limited.

Thanks so much,
Rob


_________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at http://profiles.msn.com.




XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread