为XML元素添加ID

来源:互联网 发布:java orm框架性能比较 编辑:程序博客网 时间:2024/04/29 08:00

首先下载Apache xalan,http://xml.apache.org/xalan-j/downloads.html

使用windows命令行模式,因为我没有设置java path,所以使用了如下的命令行:

java -cp xalan.jar;serializer.jar;xml-apis.jar;xercesImpl.jar org.apache.xalan.xslt.Process -IN books.xml -XSL idmaker2.xsl -OUT test.xml

其中IN后面是你要转化的源文件

XSL后面是XSLT文件

OUT是输出文件

参考:

http://xml.apache.org/xalan-j/commandline.html

http://lab.tojio.com/2009/03/06/unique-id-for-each-node-in-an-xml-file-en/

http://www.stylusstudio.com/xsllist/200512/post30240.html

http://www.roseindia.net/xml/dom/