|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
|
|
#1
|
||||
|
||||
|
XSL - nodes with only one kind of sub-nodes
Hi all,
I have a problem that I can't solve: The following sample xml file: <root> <child> <subChild1/> <subChild1/> <subChild1/> </child> <child> <subChild1/> <subChild1/> <subChild2/> </child> <root> Now I try to test if a child element only has child elements <subChild1>. I tried something like: <xsl:if test="*[name()='subChild1']"> but that didn'T work properly. Can someone help me? |
|
#2
|
||||
|
||||
|
I guess <xsl:if test="/root/child/subChild1">Yes, there's a subchild here!</xsl:if> just tests if there's one child element <subChild>.
But I wanna know if all childs of <child> are <subChild>. Is there a possibility to do that? |
|
#3
|
||||
|
||||
|
That isn't exactly the problem I tried to solve.
Sorry perhaps my question wasn't very clear. But I found something like: <xsl:template match="root/child"> <xsl:if test="count(./*)!=count(./subChild1)> The condition is true if the number of all child nodes is equal to the number of all <subChild> nodes. Thank you for helping me. Next time I try to ask more precise questions. :-) |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > XSL - nodes with only one kind of sub-nodes |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|