This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Product and Other Certifications and the fly likes Preceding siblings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "Preceding siblings" Watch "Preceding siblings" New topic
Author

Preceding siblings

Jaysakthy Muthuvelu
Ranch Hand

Joined: Nov 12, 2002
Posts: 35
Hi there,
In zvon tutorial the following question has this answer 1,2,3,4 nodes.
Iam fine with 2,3,4 nodes since they r preceding siblings,but 1st node <BBB> is the parent of <ccc/>. How come they r telling it's the preceding sibling. Plz clarify me.

//CCC/preceding-sibling::*

<AAA>
<BBB> ------- 1
<CCC/>
<DDD/>
</BBB> ------
<XXX> ------- 4
<DDD>
<EEE/> ----------2
<DDD/> ----------3
<CCC/>
<FFF/>
<FFF>
<GGG/>
</FFF>
</DDD>
</XXX> -----------
<CCC>
<DDD/>
</CCC>
</AAA>
Thanks
shakthy
Arun Mishra
Greenhorn

Joined: Jan 02, 2002
Posts: 16
Hi Jay,
I think it is looking for last CCC element, from which BBB obviously is preceding sibling.
<AAA>
<BBB>
<CCC/>
<DDD/>
</BBB>
<XXX>
<DDD>
<EEE/>
<DDD/>
<CCC/>
<FFF/>
<FFF>
<GGG/>
</FFF>
</DDD>
</XXX>
<CCC> <------ last CCC Element
<DDD/>
</CCC>
</AAA>
Please corect me if I am wrong.

Thanks,
Arun
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1167
Arun is right!
BTW, _all_ the output is from the last CCC element.
Cheers,
Dan


William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Jaysakthy Muthuvelu
Ranch Hand

Joined: Nov 12, 2002
Posts: 35
Thanks Guys!
Now iam clear.
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
Originally posted by Dan Drillich:
BTW, _all_ the output is from the last CCC element.

No, they are not all from the last CCC element. See the more readable version follow:

BTW, please use "code" button UBB to format your code, which will certainly save yours and others time.
Thanks!
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1167
Roseanne,
Please be kind to check the following -

and -

Cheers,
Dan
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
Dan,
The problem is we don't have any text in the xml, which causes the undesired result. I changed the stylesheet to make it be able to tell some thing as well as well-formated XML.
XML sourece

XSL sourece

XML result

Thanks for giving me a chance!
Cheers
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1167
I think both of us are right. You for the explanation about the siblings and me about the output of ------- 1 and ----------2 etc.
Cheers,
Dan
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
Sure, that is a team work.
We all work together to make a difference!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Preceding siblings
 
Similar Threads
mysql & incomplete insertions!
A question on Xpath
help - what's the difference: axis following and axis following-sibling?
Xpath Requirement help!!
following::* doubt