思归大哥,请进,用xsl将xml转换网页

freesnower1001 2003-12-22 01:38:05
对xsl一点也不熟悉,看了半天也不太清楚。请思归帮忙,我的xml文件如下:
- <root>
- <pagesetting>
<LANDSCAPE>true</LANDSCAPE>
<paperkind>A4</paperkind>
<paperwidth>210</paperwidth>
<paperheight>297</paperheight>
<pageleft>0</pageleft>
<pageright>0</pageright>
<pagetop>0</pagetop>
<pagebottom>0</pagebottom>
</pagesetting>
- <reporttable>
- <table x="10" y="50" border="1" bordercolor="black" maxlines="30">
- <tablehead>
- <tr height="20">
<td width="800" top="true" bottom="false" left="true" right="false" align="right" fontname="宋体" fontsize="9" fontcolor="Black" b="true" i="false" u="false" bgcolor="white">公司04证</td>
</tr>
- <tr height="50">
<td width="800" top="false" bottom="false" left="true" right="false" align="center" fontname="宋体" fontsize="15" fontcolor="Black" b="true" i="false" u="true" bgcolor="white">不符合项处理单</td>
</tr>
</tablehead>
- <tablebody>
- <tr height="16">
<td width="800" top="false" bottom="false" left="true" right="false" align="left" fontname="宋体" fontsize="9" fontcolor="Black" b="false" i="false" u="false" bgcolor="White">编号</td>
</tr>
- <tr height="16">
<td width="300" top="true" bottom="true" left="true" right="true" align="center" fontname="宋体" fontsize="9" fontcolor="Black" b="true" i="false" u="false" bgcolor="white">订货代号</td>
<td width="100" top="true" bottom="true" left="true" right="true" align="center" fontname="宋体" fontsize="9" fontcolor="Black" b="true" i="false" u="false" bgcolor="white">图号</td>
<td width="180" top="true" bottom="true" left="true" right="true" align="center" fontname="宋体" fontsize="9" fontcolor="Black" b="true" i="false" u="false" bgcolor="white">名称</td>
<td width="70" top="true" bottom="true" left="true" right="true" align="center" fontname="宋体" fontsize="9" fontcolor="Black" b="true" i="false" u="false" bgcolor="white">材质</td>
<td width="150" top="true" bottom="true" left="true" right="true" align="center" fontname="宋体" fontsize="9" fontcolor="Black" b="true" i="false" u="false" bgcolor="white">炉号</td>
</tr>
......
</tablebody>
- <tablefoot>
- <tr height="16">
<td width="80" top="true" bottom="true" left="true" right="true" align="left" fontname="宋体" fontsize="9" fontcolor="Black" b="true" i="false" u="false" bgcolor="white">打印用户</td>
<td width="120" top="true" bottom="true" left="true" right="true" align="left" fontname="宋体" fontsize="9" fontcolor="Black" b="true" i="false" u="false" bgcolor="white" />
<td width="80" top="true" bottom="true" left="true" right="true" align="left" fontname="宋体" fontsize="9" fontcolor="Black" b="true" i="false" u="false" bgcolor="white">打印时间</td>
<td width="120" top="true" bottom="true" left="true" right="true" align="left" fontname="宋体" fontsize="9" fontcolor="Black" b="true" i="false" u="false" bgcolor="white" />
<td width="400" top="true" bottom="true" left="true" right="true" align="left" fontname="宋体" fontsize="9" fontcolor="Black" b="true" i="false" u="false" bgcolor="white" />
</tr>
</tablefoot>
</table>
</reporttable>
</root>
请问怎么样写xsl,将下面的表显示出来,谢谢您的回答!!

...全文
24 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
saucer 2003-12-22
  • 打赏
  • 举报
回复
>>>没有对应的MSDN

read it online, you should be using


public void Transform(
XPathNavigator input,
XsltArgumentList args,
TextWriter output,
XmlResolver resolver
);


xslt.Transform(doc, Nothing, writer, nothing)
freesnower1001 2003-12-22
  • 打赏
  • 举报
回复
那你的意思是在1.0的环境下编译?那在1.1下怎么解决这个问题呢?我的确是用的.net2003,可我没有对应的MSDN:(,再次感谢您!!
saucer 2003-12-22
  • 打赏
  • 举报
回复
>>>下面会有一个“~~~“线

you must be using 1.1, the method is obsolete or deprecated


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="root/reporttable" />
</body>
</html>
</xsl:template>

<xsl:template match="reporttable">
<xsl:apply-templates select="*" />
</xsl:template>

<xsl:template match="tablehead">
<tHead>
<xsl:copy-of select="*" />
</tHead>
</xsl:template>

<xsl:template match="tablefoot">
<tFoot>
<xsl:copy-of select="*" />
</tFoot>
</xsl:template>


<xsl:template match="tablebody">
<tBoot>
<xsl:copy-of select="*" />
</tBoot>
</xsl:template>

<xsl:template match="table">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates select="*" />
</xsl:copy>
</xsl:template>

</xsl:stylesheet>

freesnower1001 2003-12-22
  • 打赏
  • 举报
回复
还有一个问题:为什么我用

Dim xslt As XslTransform = New XslTransform
xslt.Load(stylesheet)
.......
xslt.Transform(doc, Nothing, writer),下面会有一个“~~~“线,可我不知道错误是怎么回事。

62,025

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

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