会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
专注于 .Net (edobnet)
just do it
博客园
首页
新随笔
联系
订阅
管理
xslt使用,实现未知XML表字段内容的,表格输出,
<?
xml version="1.0" encoding="UTF-8"
?>
<
xsl:stylesheet
version
="1.0"
xmlns:xsl
="http://www.w3.org/1999/XSL/Transform"
>
<
xsl:template
match
="/"
>
<
table
cellspacing
="0"
cellpadding
="5"
align
="Center"
rules
="all"
border
="1"
style
="border-width:1px;border-style:solid;font-size:9pt;width:80%;border-collapse:collapse;"
>
<
tr
>
<!--
输出表头信息
-->
<
xsl:apply-templates
select
="/Toolkit/RTable[1]/*"
mode
="title"
/>
</
tr
>
<
xsl:for-each
select
="/Toolkit/RTable"
>
<
tr
>
<!--
出各行数据内容
-->
<
xsl:variable
name
="p"
select
="position()"
/>
<
xsl:apply-templates
select
="/Toolkit/RTable[position() = $p]/*"
mode
="ItemDetail"
/>
</
tr
>
</
xsl:for-each
>
</
table
>
</
xsl:template
>
<
xsl:template
match
="/Toolkit/RTable[1]/*"
mode
="title"
>
<
td
align
="char"
bgcolor
="#999999"
>
<
b
>
<
xsl:value-of
select
="local-name()"
/>
</
b
>
</
td
>
</
xsl:template
>
<
xsl:template
match
="/Toolkit/RTable/*"
mode
="ItemDetail"
>
<
td
>
<
xsl:text
disable-output-escaping
="yes"
>
&
nbsp;
</
xsl:text
>
<
xsl:value-of
select
="."
/>
</
td
>
</
xsl:template
>
</
xsl:stylesheet
>
posted on
2005-05-22 10:52
edobnet
阅读(
1758
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部