如何从ORACLE中倒出非缺省的XML文件

distliu 2002-07-01 05:53:47
缺省情况下,从ORACLE中倒出的XML文件格式是:
<ROWSET>
<ROW num="1">
<a>fordf0</a>
<b>week0</b>
<c>2-00:00</c>
<d>2-23:59</d>
</ROW>
</ROWSET>
要想改为
<ROWSET>
<ROW num="1">
<a>fordf0
<b>week0
<c>2-00:00</c>
<d>2-23:59</d>
</b>
</a>
</ROW>
</ROWSET>
怎么做
...全文
31 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
saucer 2002-07-01
  • 打赏
  • 举报
回复
do not know how to change the output format in Oracle, but you can always use an XSLT stylesheet to transform the data, for example


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="ROWSET | ROW ">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates select="*[position()=1]"/>
</xsl:copy>
</xsl:template>

<xsl:template match="a | b">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:value-of select="text()" />
<xsl:apply-templates select="following-sibling::*[position() = 1]" />
</xsl:copy>
</xsl:template>

<xsl:template match="c | d">
<xsl:copy-of select="." />
<xsl:apply-templates select="following-sibling::*[position() = 1]" />
</xsl:template>

</xsl:stylesheet>

8,907

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧