I have an xmlnodelist bound to a datalist. I can access root elements in the list but can't figure out how to get a child of a child. I know I should use xpath but can not seem to get it to work.
At the moment i can get root elements:
<%#(CType(Container.DataItem, System.XML.XMLNode))("low").InnerText%>
but i need to select the innertext of grandchild element "t" of a child element "part" that has a p attribute of "d"
this is what i have at the moment but it doesn't work:
<%#(CType(Container.DataItem.SelectSingleNode, System.XML.XMLNode))("part[@p=d]/t").InnerText%>
<----begin xml document
<day d="0" t="Saturday" dt="Feb 28">
<hi>30</hi>
<low>22</low>
<sunr>6:05 AM</sunr>
<suns>6:54 PM</suns>
<part p="d">
<icon>32</icon>
<t>Sunny</t> <----------------want to display this text
<wind>
<s>23</s>
<gust>N/A</gust>
<d>166</d>
<t>SSE</t>
</wind>
<ppcp>0</ppcp>
<hmid>48</hmid>
</part>
<part p="n">
<icon>31</icon>
<t>Clear</t>
<wind>
<s>21</s>
<gust>N/A</gust>
<d>124</d>
<t>SE</t>
</wind>
<ppcp>0</ppcp>
<hmid>61</hmid>
</part>
</day>
Any help would be greatly appreciated
At the moment i can get root elements:
<%#(CType(Container.DataItem, System.XML.XMLNode))("low").InnerText%>
but i need to select the innertext of grandchild element "t" of a child element "part" that has a p attribute of "d"
this is what i have at the moment but it doesn't work:
<%#(CType(Container.DataItem.SelectSingleNode, System.XML.XMLNode))("part[@p=d]/t").InnerText%>
<----begin xml document
<day d="0" t="Saturday" dt="Feb 28">
<hi>30</hi>
<low>22</low>
<sunr>6:05 AM</sunr>
<suns>6:54 PM</suns>
<part p="d">
<icon>32</icon>
<t>Sunny</t> <----------------want to display this text
<wind>
<s>23</s>
<gust>N/A</gust>
<d>166</d>
<t>SSE</t>
</wind>
<ppcp>0</ppcp>
<hmid>48</hmid>
</part>
<part p="n">
<icon>31</icon>
<t>Clear</t>
<wind>
<s>21</s>
<gust>N/A</gust>
<d>124</d>
<t>SE</t>
</wind>
<ppcp>0</ppcp>
<hmid>61</hmid>
</part>
</day>
Any help would be greatly appreciated