0

I have the following XML :

<sample>
  <Message number="2">
  <Title>Program pointer has been reset</Title> 
  <Description>
  The program pointer of task 
  <arg format="%s" ordinal="3" /> 
  has been reset. 
  </Description>
  </Message>
</sample>

I'm trying to get the decription text with arg attribute values. Something like "The program pointer of task %s 3 has been reset."

and my attempt looked something like

'/sample//Message[@number = $mId]/Description'

but that didnt work.

Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697
Ashishkumar
  • 30
  • 1
  • 6

1 Answers1

0

With XPath 2.0 or XQuery 1.0 you could use string-join(/sample//Message[@number = 2]/Description/(text() | */@*), ''). I am not sure whether Python gives you access to an XPath 2.0 or XQuery 1.0 library.

Martin Honnen
  • 160,499
  • 6
  • 90
  • 110
  • its work........thanx alot man....actually im using pydom xpath 0.1 lib..can you please provide me some links to study more about how to use xpath queries...again thanx for your help..:-) – Ashishkumar Dec 14 '11 at 13:47