我需要从XML转换为Indesign xml代码。请建议任何人知道答案。我需要从XML List-Item转换为Indesign xml代码
输入XML
<root>
<p><list list-type="order">
<list-item><p>This is quick.</p></list-item>
<list-item><p>Sivakumar Given and the fact that
<list list-type="bullet">
<list-item><p>This is sublist</p></list-item>
<list-item><p>This is sub middle list</p></list-item>
<list-item><p>This is sub last list</p></list-item>
</list>
</p></list-item>
<list-item><p>We are now left with four remaining parameters:</p></list-item>
<list-item><p>Given and the fact that</p></list-item>
<list-item><p>In Section we obtained an estimate for the mean of.</p></list-item>
<list-item><p>From steps 3, 4, and 5 above, we have generated (a table of) values for.</p></list-item>
</list></p>
</root>
所需的输出
<root>
<p><list list-type="order">
<list-item aid:pstyle="Order-First"><p>This is quick.</p></list-item>
<list-item aid:pstyle="Order-Middle"><p>Sivakumar Given and the fact that
<list list-type="bullet">
<list-item aid:pstyle="SubBullet-First"><p>This is sublist</p></list-item>
<list-item aid:pstyle="SubBullet-Middle"><p>This is sub middle list</p></list-item>
<list-item aid:pstyle="SubBullet-Last"><p>This is sub last list</p></list-item>
</list>
</p></list-item>
<list-item aid:pstyle="Order-Middle"><p>We are now left with four remaining parameters:</p></list-item>
<list-item aid:pstyle="Order-Middle"><p>Given and the fact that</p></list-item>
<list-item aid:pstyle="Order-Middle"><p>In Section we obtained an estimate for the mean of.</p></list-item>
<list-item aid:pstyle="Order-Last"><p>From steps 3, 4, and 5 above, we have generated (a table of) values for.</p></list-item>
</list></p>
感谢 西瓦库玛M.
我的答案是XSLT。或XQuery。或者使用标准API来手动编写解码/操纵/序列化XML的代码。但是:您的建议输出已损坏;如果您希望文档被现代XML工具接受,您必须为'aid:'前缀提供一个名称空间绑定。 – keshlam