使用XSU将查询转换成XML文档

ZDNet软件频道 时间:2003-02-25 作者:Techmail 代码页 |  我要评论()
本文关键词:
java OracleXML getXML -user "scott/tiger" -setXSLT emp.xsl "select * from emp"

Where emp.xsl looks like:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="/ROWSET">
    <emp_table>
      <xsl:apply-templates/>
    </emp_table>
  </xsl:template>

  <xsl:template match="ROW">
    <employee>
      <xsl:attribute name="empno"><xsl:value-of select="EMPNO"/></xsl:attribute>
      <xsl:apply-templates select="ENAME"/>
      <xsl:apply-templates select="JOB"/>
    </employee>
  </xsl:template>

  <xsl:template match="ENAME">
    <name>
      <xsl:value-of select="."/>
    </name>
  </xsl:template>

  <xsl:template match="JOB">
    <job>
      <xsl:value-of select="."/>
    </job>
  </xsl:template>

</xsl:stylesheet>


百度大联盟认证黄金会员Copyright© 1997- CNET Networks 版权所有。 ZDNet 是CNET Networks公司注册服务商标。
中华人民共和国电信与信息服务业务经营许可证编号:京ICP证010391号 京ICP备09041801号-159
京公网安备:1101082134