• 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

Selecting Node attribute in xslt

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

I have a requirement here in which i need to generate an xml using an predefined xslt. The xslt is very large and i need to pick 1 node named <BANKINFO> having attribute CodEntity, now the requirment has only if CodEntity is present in request then we need to include the bankinfo node with CodEntity attribute or else we want to skip that part.

now , what i want to know is , how do we select node and attribute combination in xslt , do we need to use <xsl:if> with some function of it in which i would be able to select the node-attribute combination and then make the flow changed according to our needs..

Please let me know about this doubt.

Thanks and Regards,
YogendraJ
 
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Yogendra,

You need to pick the desired node first and then read the property if it
exists to proceed with with your further logic. You can't pick property
directly.
 
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
You want to select a BANKINFO element, but only if it has a CodEntity attribute? Then your XPath expression would use a predicate something like this:
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic