I am trying to pull through a specific question text based on the id tag of the question. I am using pure XPath as a condition but when I have added this condition it is not pulling through the correct question and keeps referring to the top question text rather than the one I put in my condition.
The XML is as per the below:
<a:NeedsAndPriorities>
<a:Sub-Categories>
<a:Sub-Category Id="55" Display="xcat">
<a:Questions>
<a:Question Id="340" Display="xcat/Shaun test 1">
<a:QuestionText xmlns:q151="http://www.w3.org/2001/XMLSchema" p9:type="q151:string" xmlns:p9="http://www.w3.org/2001/XMLSchema-instance">Shaun test 1</a:QuestionText>
<a:PossibleAnswers />
</a:Question>
</a:Questions>
<a:CategoryName xmlns:q152="http://www.w3.org/2001/XMLSchema" p7:type="q152:string" xmlns:p7="http://www.w3.org/2001/XMLSchema-instance">xcat</a:CategoryName>
</a:Sub-Category>
<a:Sub-Category Id="160" Display="New">
<a:Questions>
<a:Question Id="4" Display="New/Test Mortgage Question">
<a:QuestionText xmlns:q153="http://www.w3.org/2001/XMLSchema" p9:type="q153:string" xmlns:p9="http://www.w3.org/2001/XMLSchema-instance">Test Mortgage Question</a:QuestionText>
<a:PossibleAnswers>
<a:PosibleAnswer>
<a:Answer>Test mortgage Answer-1</a:Answer>
</a:PosibleAnswer>
My path is
//NeedsAndPriorities/Sub-Categories/Sub-Category/Questions/Question/QuestionText
My condition is
//NeedsAndPriorities/Sub-Categories/Sub-Category/Questions/Question[@Id = '4']
again this is using pure xpath and it is not nested in the xml. Whenever i run the condition it is pulling through the question text for "340" 'Shaun test 1'.
Any ideas where i am going wrong?