• 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 two attribute values on one line....

 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to select something, in a stylesheet, based on the value of two attributes...
Say, my input has an array of elements:
<MyElement id="d1" type="string" value="value1"/>
<MyElement id="d2" type="string" value="value2"/>
<MyElement id="d3" type="string" value="value3"/>

In the style sheet I am trying to do this:
<xsl:variable name="eVal" select="./MyElement[position()=2][@value]"/>
Is this possible ?
My intent is to select the value "value2" but I seem to be getting
a "" null string.
Any help is appreciated......
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Haven't tested it..
but have you tried the below code
<xsl:variable name="eVal" select="./MyElement[position()=2]/[@value]"/>
this link will also help you http://www.dpawson.co.uk/xsl/sect2/N1553.html
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That works.
Thanks for the link also.
- m
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic