XSLT and XML namespace issue

P

pc.candy

Hi there

I'm having some difficulty with transforming xml data with more than
one namespace defined in the xml.
I'm able to bring back some values of the xml but not others in
another namespace?
For example from the following xml data I can bring bring back the
value for <address> but I can't seem to figure out how to bring back
the <CountryNameCode> which is in another namespace.
I'm not able to manipulate the xml output, but I'm able to customise
the xslt.
Below is the example xml and the xslt I'm trying to use.

/******************* XML data *********************************/

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Response>
<name>ABC Compnay</name>
<Status>
<code>200</code>
<request>geocode</request>
</Status>
<Placemark id="p1">
<address>123 Harris St, Pyrmont, NSW 2009, Australia</address>
<AddressDetails Accuracy="8"
xmlns="urn:eek:asis:names:tc:ciq:xsdschema:xAL:2.0">
<Country>
<CountryNameCode>AU</CountryNameCode>
</Country>
</AddressDetails>
</Placemark>
</Response>
</kml>

/********************************************************/

/**************** XSLT I'm using *********************/

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:asx="http://www.sap.com/abapxml" xmlns:kml="http://
earth.google.com/kml/2.0"
xmlns:AddressDetails="urn:eek:asis:names:tc:ciq:xsdschema:xAL:2.0"
version="1.0">
<xsl:template match="/">
<asx:abap version="1.0">
<asx:values>
<GEOCODE>
<STREET>
<xsl:value-of select="kml:kml/kml:Response/kml:placemark/
kml:address"/>
</STREET>
<COUNTRY>
<xsl:value-of select="kml:kml/kml:Response/kml:placemark/
kml:AddressDetails/AddressDetails:Country/
AddressDetails:CountryNameCode"/>
</COUNTRY>
</GEOCODE>
</asx:values>
</asx:abap>

</xsl:template>

</xsl:transform>

/**********************************************************/

Does anyone have any ideas to what I should change in the XSLT??

Thanks.
 
J

Johannes Koch

<kml xmlns="http://earth.google.com/kml/2.0"> [...]
<AddressDetails Accuracy="8"
xmlns="urn:eek:asis:names:tc:ciq:xsdschema:xAL:2.0">

Here you use an AddressDetails element from the
urn:eek:asis:names:tc:ciq:xsdschema:xAL:2.0 namespace. Is taht what you want?

[...]
<xsl:value-of select="kml:kml/kml:Response/kml:placemark/
kml:AddressDetails/AddressDetails:Country/
AddressDetails:CountryNameCode"/>

See above: AddressDetails is not in the http://earth.google.com/kml/2.0
namespace.
 
P

pc.candy

<kml xmlns="http://earth.google.com/kml/2.0"> [...]
<AddressDetails Accuracy="8"
xmlns="urn:eek:asis:names:tc:ciq:xsdschema:xAL:2.0">

Here you use an AddressDetails element from the
urn:eek:asis:names:tc:ciq:xsdschema:xAL:2.0 namespace. Is taht what you want?

[...]
<xsl:value-of select="kml:kml/kml:Response/kml:placemark/
kml:AddressDetails/AddressDetails:Country/
AddressDetails:CountryNameCode"/>

See above: AddressDetails is not in thehttp://earth.google.com/kml/2.0
namespace.

Hi Johannes

Yes I do want the AddressDetails element in that namespace also.
What xslt should I use to transform this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top