Click here to Skip to main content
15,741,947 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:

can you help to find the Mixed nodes in the given XML?

<child id="1">
word text <name>first name</name> word text
<child id="2">
word text

<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">


1 solution

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"

Are you getting the idea? There is no any "mixed" nodes here. Instead of having a text node with some content in the middle, you have two separate ones. I hope it will help you.

Share this answer
codeninja-C# 24-Jun-13 1:57am    
Hi SA,
Thanks for your response My +5.
I know there is no key word to find mixed-nodes in Xpath.
My understanding is,
if count(text()) > 0
then current node is mixed node
please correct me if i am wrong

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900