2006-12-08

如何将XML文件中的数据传送并保存在关系数据库中

来源: 开发者在线 作者:佚名 评论 0 条
 

<xsl:if test="position() != 1">

<xsl:text>, </xsl:text>

</xsl:if>

<xsl:value-of select="name(.)"/>

</xsl:template>

<!--

Template:match="*" mode="value"

Programmer:Edmond Woychowsky

Purpose:The purpose of this template is to list the column values.

Update Date:Programmer:Description:

-->

<xsl:template match="*" mode="value">

<xsl:variable name="text">

<xsl:call-template name="in">

<xsl:with-param name="list" select="$textColumns"/>

<xsl:with-param name="value" select="name(.)"/>

</xsl:call-template>

</xsl:variable>

<xsl:variable name="date">

<xsl:call-template name="in">

<xsl:with-param name="list" select="$dateColumns"/>

<xsl:with-param name="value" select="name(.)"/>

</xsl:call-template>

</xsl:variable>

<xsl:if test="position() != 1">

<xsl:text>, </xsl:text>

</xsl:if>

<xsl:choose>

<xsl:when test="$text = 'true'">

<xsl:text>'</xsl:text>

<xsl:call-template name="sqlApostrophe">

<xsl:with-param name="string" select="."/>

</xsl:call-template>

<xsl:text>'</xsl:text>

</xsl:when>

<xsl:when test="$date = 'true'">

<xsl:value-of select="."/>

</xsl:when>

<xsl:otherwise>

<xsl:value-of select="."/>

</xsl:otherwise>

</xsl:choose>

</xsl:template>

</xsl:stylesheet>

结论

过去几年来,我一直在使用这种,或与它类似的方法,都取得了很好的效果。尽管从SQL角度看,它的执行速度比不上比更常见的建立SQL的字符串串联方法提供更好结果的存储过程。我还想指出的是,我说过我使用这个或与它类似的方法,基本只增加了commit和rollback语句来处理错误。不过,这些修改仅仅是个人尝试和个人偏执行为。


共4页: 上一页 [1] [2] [3] 4 下一页

(本文仅表明作者个人观点,不代表本站及其管理员立场.) 推荐 收藏 投稿 打印 返回 关闭
上一篇:如何从一个php文件向另一个地址post数据,不用表单和隐藏的变量  
下一篇:Mashups:Web 应用程序新成员
    评论加载中…
 推荐文章
     

网站首页  -  网站地图 -   站长论坛  -  网站投稿  -    -  网站管理
Copyright © 2008 芜湖站长站 All Rights Reserved 皖ICP备07500611号