• 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

XSLT - Getting Parent Node based on child node

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have an XML from which i need to build a condition. I am able to do it. But iam thinking to modularize it. While i try to do that i have some problems.


I use the following XSLT

In the sample xlst i had handled the Tag <Status>.It works fine.I can do the same for the Rest of the Predicates in the same way. But i am think of handling each predicate <Days>,<Region> using a seperate Template. So it would be easy to maintain in the future.
The problem i am facing i am not able to select Predicate. For eg. if i want to handle the predicate <Staus> i need to pass the following tag

to the handling template. This is because Predicate can contain Operator. Is there any way to do it?
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Arulanand Dayalan:
Is there any way to do it?

Sorry, I got lost in that long post. What is it you want to do?
 
Arulanand Dayalan
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Paul Clapham

Thanks Paul for reading my post. I am trying to modularize the xslt. I want to hadle each predicate(eg, Days,Region) in a seperate template. For eg. i want to pass the below node to my template and handle it there.
<Predicate>
<Days>
<Min>10</MIN>
<Max>20</MAX>
</Days>
</Predicate>

I am looking for the method to select this entire node and pass it to the template to handle it.

Thanks in Advance.

Regards,
Arul.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am a bit confused by your procedural terminology. You don't select elements and pass them to templates. You declare templates and arrange things so that the templates will be executed. In this particular example:and in your template that matches the root element:This sort of example appears pretty early on in just about every XSLT reference book.
 
reply
    Bookmark Topic Watch Topic
  • New Topic