Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XPath Question

Status
Not open for further replies.

steveflitmcp

Programmer
Joined
Sep 5, 2003
Messages
3
Location
GB
I have the following XML string.
How can I select the TargetValue using an XPath query???
Please help, I've struggled for ages.
The problem is it's a child of a child and the syntax child:: etc is beating me.
Cheers in advance

<Measures>
<Measure>
<ID>208</ID>
<PMID>5</PMID>
<PMStatusID>5</PMStatusID>
<Target>
<MeasureTarget>
<HighLowRange>H</HighLowRange>
<TargetValue>100000</TargetValue>
<UpperLimit />
<LowerLimit />
</MeasureTarget>
</Target>
<CurrentValue>0</CurrentValue>
<MeasureStatus>Below Target Range</MeasureStatus>
<DisplayColour>#CC0000</DisplayColour>
<Title>Bank funds</Title>
</Measure>
</Measures>
 
Code:
//TargetValue/text()

-pete
 
Hi,
Nope that doesnt work.
I can select //Target or //Measure and they work but not //TargetValue. Is it because it is a child of Target and Measure Target????
HELP
 
>> Nope that doesnt work.

It does work using MSXML4 on Windows 2000 Professional. That is what i tested with before posting the answer. :-)

-pete
 
Try using xsl stylesheet thus

...
<xsl:for-each select=&quot;Measure/Target&quot;>
<xsl:value-of select=&quot;TargetValue&quot; />
</xsl:for-each>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top