如果条件为真,则使用xml文档复制段落 [英] using xml document replicate paragraph if condition equals true

查看:69
本文介绍了如果条件为真,则使用xml文档复制段落的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是xml文档的新手:-)希望您能为我提供帮助.以下是我的情况.

输入



i am new to xml doc stuff :-) hope u can help me. below is my scenario.

input

<fn-group>
<fn id="1"><p>For example, the <format>sixteenth-century</format> cow</p>
<p>Other new seventeenth-century cow</p>
<p>this is my text</p></fn>
<fn id="2"><p>For example, the sixteenth-century cow</p>
<p>Other new seventeenth-century cow</p>
<p>this is my text</p></fn>
<fn-group>







[condition]
if the <fn> tag contains <format> tag then the whole <fn> should be replicated right after


之后复制

预期输出:




expected output:

<fn-group>
<fn id="1"><p>For example, the <format>sixteenth-century</format> cow</p>
<p>Other new seventeenth-century cow</p>
<p>this is my text</p></fn>
<fn id="1"><p>For example, the <format>sixteenth-century</format> cow</p>
<p>Other new seventeenth-century cow</p>
<p>this is my text</p></fn>
<fn id="2"><p>For example, the sixteenth-century cow</p>
<p>Other new seventeenth-century cow</p>
<p>this is my text</p></fn>
<fn-group>



谢谢,
Chaegie



Thanks,
Chaegie

推荐答案

我相信使用XSLT模板可以解决您的问题.
I believe that using XSLT templates could solve your problem.


这篇关于如果条件为真,则使用xml文档复制段落的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆