[XSLTalk] XPATH + Namespaces

All,

I have an Xpath problem which I had cured but unfortunately the namespaces 
have changed and my Xpath no longer works.  I have the following XML:

<GovTalkMessage xmlns="http://www.govtalk.gov.uk/CM/envelope">
	<EnvelopeVersion>1.0</EnvelopeVersion>
	<Header>
		<MessageDetails>
			<Class>ADM-address-request</Class>
			<Qualifier>request</Qualifier>
			<TransactionID>L9MLHH1FB25F</TransactionID>
			<CorrelationID>296</CorrelationID>
			<GatewayTimestamp>2003-07-15T14:00:04</GatewayTimestamp>
		</MessageDetails>
	</Header>
	<Body>
		<AddressRequest xmlns="http://www.govtalk.gov.uk/gateway/addressrequest">
			<ServiceName>QES-ORG</ServiceName>
			<Key Type="ruref">49900011596T</Key>
		</AddressRequest>
	</Body>
</GovTalkMessage>

I want to say:

sRURef=oDOM.selectSingleNode("GovTalkMessage/Body/AddressRequest/Key[@Type='ruref']").text

This works fine when I remove the Namespaces.  But obviously in a real world 
scenario this is not applicable.  I went through this before and it was 
something to do with the default namespace and MSXML4.

I have added the following code:

sNameSpaces = "xmlns:ar='http://www.govtalk.gov.uk/CM/envelope'"
oDOM.setProperty "SelectionNamespaces", sNameSpaces

and then try and use xpath like so

sRURef=oDOM.selectSingleNode("ar:GovTalkMessage/Body/AddressRequest/Key[@Type='ruref']").text

but still I get the same error.

Can anyone help me out.  Also what do I do about the locally declared 
namespace on the <AddressRequest> tag.

Any help at all greatly appreciated.

Paul



dagda1@hotmail.com

_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://www.msn.co.uk/messenger


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Free shipping on all inkjet cartridge & refill kit orders to US & Canada. Low prices up to 80% off. We have your brand: HP, Epson, Lexmark & more.
http://www.c1tracking.com/l.asp?cid=5510
http://us.click.yahoo.com/GHXcIA/n.WGAA/ySSFAA/2U_rlB/TM
---------------------------------------------------------------------~->

This discussion list is hosted at TopXML (topxml.com).  If you like what we're doing, please show your support by posting your small code snippets there!  Also, post your tech announcements and news on our new site, Markup World (markupworld.com)

To unsubscribe from this group, send an email to:
XSLTalk-unsubscribe@egroups.com
 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

Received on Tuesday, 15 July 2003 10:30:16 UTC