Ant xslt 任务输出到标准输出 [英] Ant xslt task output to stdout

查看:45
本文介绍了Ant xslt 任务输出到标准输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 ant 中的任务,如何将输出生成到标准输出?

Using the <xslt> task in ant, how do I get the output to generate to stdout?

我的 XSLT 正在通过 xsl:result-document 生成多个文件,而正常输出只是我希望与正常 Ant 输出一起显示的状态信息.Ant 似乎强迫我提供一个 destdir= 或一个 out= 参数.

My XSLT is generating multiple files through xsl:result-document and the normal output is just status information that I'd like to show up with normal Ant output. Ant seems to force me to supply a destdir= or an out= parameter.

Ant 1.8.2 和 Saxon 9

Ant 1.8.2 with Saxon 9

推荐答案

是的,ant 就是这样做的.但是,XSLT 具有可用于在 stdout 上获取输出的元素 :)

Yes ant does this. However XSLT has the element which you can use to get output on the stdout :)

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:key name="types" match="a" use="text()"/>
<xsl:template match="/">
<result>
  <xsl:message terminate="no">I am a message from xslt!</xsl:message>
</result>
</xsl:template>
</xsl:stylesheet>

输出:

build:
 [xslt] Processing C:\Users\Stefanos\Documents\Visual Studio 2010\Projects\stackOverflow\stackOverflow\test.xml to C:\Users\Stefanos\Documents\Vis
ual Studio 2010\Projects\stackOverflow\stackOverflow\out.xml
 [xslt] Loading stylesheet C:\Users\Stefanos\Documents\Visual Studio 2010\Projects\stackOverflow\stackOverflow\test.xslt
 [xslt] I am a message from xslt!

BUILD SUCCESSFUL
Total time: 0 seconds

希望有帮助!

这篇关于Ant xslt 任务输出到标准输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆