Xslt 任务未按预期工作
我有一个在 VS 中开发的 XSLT 转换。当我使用 VS 运行它时(通过 XML->Show Xslt Output)它效果很好。然而,当我通过 MsBuildCommunityTasks Xslt 任务执行它时,我得到了截然不同的结果。
具体来说,输出只是一些我什至没有在 XSLT 中引用的元素的内容。我猜默认的变换是拾取它们。
我的任务声明再简单不过了:
<Xslt
Inputs="BuildLogs\partcover-results.xml"
Xsl="ExtTools\xslt\partcover.assembly.report.xsl"
RootTag=""
RootAttributes=""
Output="partcover.assembly.report.html"
/>
也许 msbuildtasks 使用的 XSLT 引擎与 VS 内部使用的不同?任何指导将不胜感激。
I have an XSLT transform that I developed in VS. It works great when I use VS to run it (via XML->Show Xslt Output). However, when I execute it via the MsBuildCommunityTasks Xslt task I get wildly different results.
Specifically, the output is only the contents of a handful of elements I don't even reference in my XSLT. I guess the default transform is picking them up.
My task declaration couldn't get any simpler:
<Xslt
Inputs="BuildLogs\partcover-results.xml"
Xsl="ExtTools\xslt\partcover.assembly.report.xsl"
RootTag=""
RootAttributes=""
Output="partcover.assembly.report.html"
/>
Perhaps msbuildtasks is using a different XSLT engine than VS uses internally? Any guidance would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我也无法让
正常工作。从 .NET 4.0 开始,内置了 XmlTransformation 任务。以下是您的示例的外观:第一次为我工作!感谢 城市 Canuk 的 Bryan Cook,嗯提供了 MSBuild 中 XSLT 选项的良好概述
I had trouble getting
<Xslt />
to work as well. As of .NET 4.0, there is built in XmlTransformation task. Here is how it would look for your example:Worked for me the first time! Credit to Bryan Cook at the urban canuk, eh for providing a nice overview of the XSLT options in MSBuild
我还花了一些时间尝试让这个 Xslt 任务正常工作,摆弄 RootTag 和属性。大约两个小时后,我放弃了,而是编写了自己的任务来完成这项工作,这在我的第一次尝试中发挥了作用。
I also spent some time on trying to get this Xslt-task working, fiddling with the RootTag and Attributes. After some 2 hours i gave up and instead wrote my own task to get this done, which worked on my first try..
RootTag 在转换运行之前应用,而不是之后。编写 xslt 时考虑 RootTag,它会起作用
The RootTag is applied before the transformation is run, not after. Take the RootTag into consideration when writing your xslt, and it will work