• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Preceding siblings

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Arun is right!
BTW, _all_ the output is from the last CCC element.
Cheers,
Dan
 
Jaysakthy Muthuvelu
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Guys!
Now iam clear.
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Roseanne,
Please be kind to check the following -

and -

Cheers,
Dan
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure, that is a team work.
We all work together to make a difference!
 
reply
    Bookmark Topic Watch Topic
  • New Topic