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.

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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..:-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.