在通用表达式

时间:2017-08-09 14:04:00

标签: xml xslt xpath

我的问题:

我有一个xml源代码转换为Excel 2003 xml。

我必须在不同级别添加名称相同的节点:

root\tag1\tag2\tag3\**my_node**
root\tag1\tag2\tag3\tag3\**my_node**
root\tag1\tag2\tag3\tag3\tag3\tag3\**my_node**

我可以从通用表达式访问my_node,无论它前面有多少个tag3?

1 个答案:

答案 0 :(得分:0)

  

我可以从通用表达式访问my_node,无论多少   tag3在它之前?

是的,但在处理能力方面却很昂贵:

<div id="serviceTop">
<h2>We put time back in your week.</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam purus lacus, vestibulum a augue quis, dignissim venenatis arcu. Donec faucibus pulvinar viverra. Curabitur semper ex ex, ut fermentum risus tempus sit amet. Nunc in diam id nibh molestie fermentum sit amet suscipit tortor.</p>
<p>Donec faucibus pulvinar viverra. Curabitur semper ex ex, ut fermentum risus tempus sit amet. Nunc in diam id nibh molestie fermentum sit amet suscipit tortor.</p>
<h3>Here to simplify your day!</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam purus lacus, vestibulum a augue quis, dignissim venenatis arcu. Donec faucibus pulvinar viverra. Curabitur semper ex ex, ut fermentum risus tempus sit amet. Nunc in diam id nibh molestie fermentum sit amet suscipit tortor.</p>
<p>Donec faucibus pulvinar viverra. Curabitur semper ex ex, ut fermentum risus tempus sit amet. Nunc in diam id nibh molestie fermentum sit amet suscipit tortor.</p>
</div>
<p>&nbsp;</p>
<div id="minicontact">
<h3 id="miniformtitle">Get Started</h3>
<form class="contact" action="&lt;?=$_SERVER['REQUEST_URI'];?&gt;#cform1" method="post" name="simp_cont">
<p><br /> <input id="captcha" class="input" style="position: absolute; left: -9999px;" name="captcha" type="text" /><br /> <input id="name" name="fname" type="text" placeholder="NAME" /><br /> <input id="phone" name="phone" type="text" placeholder="PHONE NUMBER" /><br /> <input id="email" name="email" type="text" placeholder="EMAIL ADDRESS" /><br /> <input id="footage" name="footage" type="text" placeholder="ESTIMATED SQUARE FOOTAGE" /><br /> <textarea class="textarea" name="message" placeholder="COMMENTS"></textarea></p>
</form></div>

将在文档中的任意位置选择//mynode ,并且:

mynode

将选择/root/tag1/tag2/tag3//my_node 的后代的任何my_node