只是一个快速的问题。我有一个 XML,我希望只转换其中的一部分而不更改其他任何内容。这是我想要做的一个简单的例子:
输入:
<?xml version="1.0" encoding="UTF-8"?>
<dita xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/ditabase.xsd">
<topic id="abc">
<title>Sample XML</title>
<body>
<section id="a">
<p> Hello section A </p>
</section>
<section id="b">
<p> General Content </p>
</section>
<section id="c">
<p> Hi thank you for coming from $state </p>
</section>
</body>
</topic>
</dita>
输出
<?xml version="1.0" encoding="UTF-8"?>
<dita xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/ditabase.xsd">
<topic id="abc">
<title>Sample XML</title>
<body>
<section id="a">
<p> Hello section A </p>
</section>
<section id="b">
<p> General Content </p>
</section>
<section id="c" audience = "WA">
<p> Hi thank you for coming from WA </p>
</section>
<section id="c" audience = NY">
<p> Hi thank you for coming from NY </p>
</section>
<section id="c" audience = "AL">
<p> Hi thank you for coming from AL </p>
</section>
<section id="c" audience = "GA">
<p> Hi thank you for coming from GA </p>
</section>
...
<!--Continue for the rest of the states-->
...
</body>
</topic>
</dita>
如果有帮助的话,我正在使用 XALAN 处理器。提前非常感谢:D