这是一个棘手的问题。我有一个contents.xml文件引用其他文件的主机。这些其他文件使用.xml,并已被修改为.dita,我的问题是我如何重命名所有的.xml文件扩展名为.dita?文件路径在树中是不同的级别,并且前面的子文件夹数量不一致。
例子:更改XML文件内的文件扩展名
<article
xmlns:xi="http://www.w3.org/2001/XInclude">
<title>Definition</title>
<xi:include href="./introduction.xml"/>
<section xml:id="viewComponents"><title>View Components</title>
<xi:include href="./components/page.xml"/>
<xi:include href="./views/sheet.xml"/>
<xi:include href="./folder/xsubfolders/plaque.xml"/>
</section>
</article>
要:
<article
xmlns:xi="http://www.w3.org/2001/XInclude">
<title>Definition</title>
<xi:include href="./introduction.dita"/>
<section xml:id="viewComponents"><title>View Components</title>
<xi:include href="./components/page.dita"/>
<xi:include href="./views/sheet.dita"/>
<xi:include href="./folder/xsubfolders/plaque.dita"/>
</section>
</article>
好问题,+1。看到我的答案是一个简短而完整的解决方案。 :) – 2010-10-28 16:37:00
我很困惑,为什么答案都是样式表。为什么不创建一个快速脚本来查找字符串“.xml”并将其替换为“.dita”? – RyanJM 2010-10-28 16:41:14
@RyanJM:难道是因为问题用'xslt'标记?难道是因为你可以有一个名为'this.xml'的元素? – 2010-10-28 16:45:40