如何在给定的XML中找到混合节点? [英] How to find mixed node in given XML?
本文介绍了如何在给定的XML中找到混合节点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你能帮忙找到给定XML中的混合节点吗?
XML
Hi,
can you help to find the Mixed nodes in the given XML?
XML
<node>
<child id="1">
word text <name>first name</name> word text
</child>
<child id="2">
word text
</child>
</node>
XSLT
XSLT
<xsl:template match="*">
<!--
******* it should be check current node is mixed node or not *******
******* mixed node : it contains both text + nodes *******
<xsl:if test="self = mixed-node">
</xsl:if>
-->
<xsl:template>
谢谢,
--SJ
Thanks,
--SJ
推荐答案
没有混合节点这样的东西。我认为您的难度与您在其他文本中间有节点< name>名字< / name>
的情况有关。事实上,没有这样的事情。从DOM的角度来看,实际的层次结构如下所示:
There is no such thing as "mixed nodes". I think your difficulty is related to the case where you have the node<name>first name</name>
"in the middle of other text". In fact, there is no such thing. From the DOM standpoint, the actual hierarchy looks like this:
Element: "child"
Text node: "word text "
Element: "name"
Text node: "first name"
Text node: "word text"
你明白了吗?这里没有任何混合节点。您可以使用两个单独的内容,而不是在中间包含某些内容的文本节点。我希望它会对你有所帮助。
这篇关于如何在给定的XML中找到混合节点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文