开发者

XSLT: Transform XML files tree

I have the following file structure (XML files 'index.xml' in nested folders):

index.xml
foo/index.xml
foo/sub/index.xml
foo/.../index.xml
bar/.../index.xml

Now I have to transform each of this XML files with a given XSL stylesheet. The result should be the same folder 开发者_如何学JAVAstructure (overwriting would be OK). What would be your approach to achieve this?

My system: OS X 10.6, Saxon XSLT processor


Using Bash How about putting the find command in a file and make the file executable:

find . -iname "*.xml" -exec transformcommand {} \;

(The {} will be replaced with the found file.)

Using Ant If you want something more platform independent you could write a simple Ant task for it. Have a look at the Ant XSLT Task, which could be combined with the <for>-tag.

Example:

<xslt in="input.xml"
      out="output.txt"
      style="thexsltfile.xsl"
      force="true"
      classPath="lib/saxon9.jar"/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜