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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XPATH - wierd problem with sub elements

Status
Not open for further replies.

supermatchgame

Programmer
May 16, 2007
50
GB
Here's an xml fragment:

Code:
  <?xml version="1.0" encoding="ISO-8859-1" ?> 
- <DataSourceMessage xmlns="[URL unfurl="true"]http://www.govtalk.gov.uk/Education/ISIndexDataSourceMessage"[/URL] xmlns:apd="[URL unfurl="true"]http://www.govtalk.gov.uk/people/AddressAndPersonalDetails"[/URL] xmlns:bs7666="[URL unfurl="true"]http://www.govtalk.gov.uk/people/bs7666"[/URL] xmlns:cdt="[URL unfurl="true"]http://www.govtalk.gov.uk/people/ContactDetails"[/URL] xmlns:ind="[URL unfurl="true"]http://www.govtalk.gov.uk/Education/ISIndexCommon"[/URL] xmlns:xsi="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance"[/URL] xsi:schemaLocation="[URL unfurl="true"]http://www.govtalk.gov.uk/Education/ISIndexDataSourceMessageISIndexDataSourceMessage-v1-1.xsd">[/URL]
- <DataSourceHeader>
  <ind:SourceSystemDomain /> 
  <ind:SourceSystemCode /> 
  <ind:SentTimestamp>2008-08-18T12:58:39</ind:SentTimestamp> 
  <ind:RecordCount>N</ind:RecordCount> 
  <ind:LoadAction>x</ind:LoadAction> 
  <ind:DataSourceBatchId /> 
  </DataSourceHeader>
- <DataSourceRecords>
- <ind:DataSourceRecord CorrelationId="n">
- <ind:ChildNames>
- <ind:ChildName>
  <ind:FamilyName>madeup</ind:FamilyName> 
  <ind:GivenName1>madeup</ind:GivenName1> 
  </ind:ChildName>
  </ind:ChildNames>
- <ind:Addresses>
- <ind:ChildAddress>
- <ind:UKAddress>
- <apd:A_5LineAddress>
  <apd:Line>madeup</apd:Line> 
  <apd:Line>madeup</apd:Line> 
  <apd:Line>madeup</apd:Line> 
  <apd:PostCode>madeup</apd:PostCode> 
  </apd:A_5LineAddress>
  </ind:UKAddress>
  </ind:ChildAddress>
  </ind:Addresses>

Can someone who knows more about this please tell me why the XPATH statement
Code:
<xsl:value-of select="ind:Addresses/ind:ChildAddress/ind:UKAddress/apd:A_5LineAddress/apd:Line[1]"></xsl:value-of>
is returning absolutely no data, but the statement
Code:
<xsl:value-of select="ind:Addresses/ind:ChildAddress/ind:UKAddress/*"></xsl:value-of>
returns all the lines of the address? What is going on? By the way at the top of my xsl stylesheet I have the following statement:
Code:
<xsl:for-each select="/x:DataSourceMessage/x:DataSourceRecords/ind:DataSourceRecord">
 
You have not declared the namespace with prefix apd.
 
Again, thanks - missed the 'www' off the apd namespace.

I need to go home...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top