• 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

XSL

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
Here is my xml file say trial.xml
<?xml version="1.0"?>
<Accounting name="vidya" age="25">
<Segment id="100">Test</Segment>
<Segment type="GL/Account" id="120" description="Account">Test1</Segment>
<Segment type="Distribution" id="220" description="Distribute"/>
</Accounting>

Now I need to fetch the "id" value when type="Distribution"
So I tried writing the code in my xsl stylesheet as
<xsl:value-of select="Accounting/Segment/@type[@id='220'] "/>
But this is not giving me any results.. Any idea where exactly I am going wrong. If I try the same method for returning element value, it works but not working for attribute value.. Please help!!!
 
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you want
"Accounting/Segment[@id='220']/@type"
The Segment is the node that has the id attribute.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic