为什么不能输出''使用XslCompiledTransform将.xml转换为.html时

时间:2015-09-11 02:57:28

标签: c# xml xslt

我想使用XslCompiledTransform使用xsl转换xml。但是我发现脚本块的格式为<script src="..."/>而非<script src="..." ></script>,如何使其正确?

即使我的xsl文件如下:

<html>
<head>
    <title>Hello iCore Project</title>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css"/>
<script src="http://code.jquery.com/jquery-1.8.3.min.js" ></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>

</head>

<body>
...

1 个答案:

答案 0 :(得分:1)

在XML格式中,<script ...></script><script ... />两种格式均有效且等效。

强制结束标记将<xsl:output method="html"/>添加到样式表。