File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Product and Other Certifications and the fly likes following::* doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "following::* doubt " Watch "following::* doubt " New topic
Author

following::* doubt

Micheal Jacob
Ranch Hand

Joined: Nov 25, 2002
Posts: 89
This is XML File


This is XSL


What is the output & please explain.
Micheal Jacob
Ranch Hand

Joined: Nov 25, 2002
Posts: 89
Please ignore the above entry.
XML File :



XSL File :

What is the output & please explain.
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1167
Please try the following -

And

Happy New Year!
Dan


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

Joined: Nov 14, 2000
Posts: 1953
Here is a simpler approach, use the following stylesheet on Micheal's original xml:

Result xml:

Then you count them by hand to see they match.
Micheal Jacob
Ranch Hand

Joined: Nov 25, 2002
Posts: 89
Hi Everybody,
Thanks for reply.
But we form pattern as //GGG/following::*
so it will search for all possible GGG node, we have two node names as GGG
for first GGG node there are 12 nodes for following, what abt second GGG node why we are not counting that.(<XXX><AAA> should come right ?)
Please explain.
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
Did you read the result from my above post?
12
2
Micheal Jacob
Ranch Hand

Joined: Nov 25, 2002
Posts: 89
Hi Roseanne,
I have compiled your code.

u have only count(following::*) so it is giving 12 & 2
but if i have count(//GGG/following::*) without for-each, it should give me 14 right ?
Just i am putting this inside <template match="/">
Please correct me if i am wrong.
Micheal
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
You only did it once, the first GGG's followings, that was why you got 12 only.
Be careful to learn how to interpret a node-set. There are many good tutorials on the web. I don't remember which one explains this better. But actually your practice result is the best tutor. Try different combinations/permutations in code, then you find your own answer. That is my way to learn it. I'm still learning...
Micheal Jacob
Ranch Hand

Joined: Nov 25, 2002
Posts: 89
Hi Roseanne
ya, well said.
But i am not convinced on this....i am using the same xml given by u and my xsl is


this gives me 2 and yes it suppose to give me 2 only.
but when i change //GGG/self::* to //GGG/following::* i should get 14 right ? it gives me 12.
is my question make sense ?
Micheal
 
wood burning stoves
 
subject: following::* doubt
 
Similar Threads
Xpath Requirement help!!
Question on apply template
A question on Xpath
Preceding siblings
help - what's the difference: axis following and axis following-sibling?