473,394 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

XSLT and XML namespace issue

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 <addressbut I can't seem to figure out how to bring back
the <CountryNameCodewhich 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:oasis: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:oasis:names:tc:ciq:xsdsc hema: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.

Jun 22 '07 #1
4 4310
pc******@gmail.com schrieb:
<kml xmlns="http://earth.google.com/kml/2.0">
[...]
<AddressDetails Accuracy="8"
xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">
Here you use an AddressDetails element from the
urn:oasis: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.

--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Jun 22 '07 #2
On Jun 22, 5:40 pm, Johannes Koch <k...@w3development.dewrote:
pc.ca...@gmail.com schrieb:
<kml xmlns="http://earth.google.com/kml/2.0">
[...]
<AddressDetails Accuracy="8"
xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">

Here you use an AddressDetails element from the
urn:oasis: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.

--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Hi Johannes

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

Jun 23 '07 #3
pc******@gmail.com schrieb:
What xslt should I use to transform this?
You have to correct your _XML_ file. As I wrote: currently the
AddressDetails is not in the http://earth.google.com/kml/2.0 namespace.
--
Johannes Koch
Spem in alium nunquam habui praeter in te, Deus Israel.
(Thomas Tallis, 40-part motet)
Jun 23 '07 #4
Johannes Koch schrieb:
pc******@gmail.com schrieb:
>What xslt should I use to transform this?

You have to correct your _XML_ file. As I wrote: currently the
AddressDetails is not in the http://earth.google.com/kml/2.0 namespace.
.... because you set the default namespace for this element and its child
elements to urn:oasis:names:tc:ciq:xsdschema:xAL:2.0
--
Johannes Koch
Spem in alium nunquam habui praeter in te, Deus Israel.
(Thomas Tallis, 40-part motet)
Jun 23 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Harry Zoroc | last post by:
I would like to treat an xsd Schema file as XML file and to display the targetNamespace and all the imports. That's it. But the following does not work. Why? I did not enter the stylesheet in the...
4
by: cyclops | last post by:
I'm trying to do XML + XSLT -> Another XML. The source XML contains multiple namespaces and XSLT will handle all possible tags under each name space. ----source---- <document xmlns="..."...
4
by: Richard L Rosenheim | last post by:
Here's a sample XML file (created by saving a dataset): <?xml version "1.0" standalone="yes"?> <dsData xmlns="http://tempuri.org/DataSchema.xsd"> <Configuration> </Configuration> <Data>...
6
by: Christopher | last post by:
I am currently in the process of evaluating the performance hits of moving to the .NET platform for our application. I created a sample project that loads the transforms the same XML and XSLT in...
1
by: Nick | last post by:
I am working on a website for a client and one of their requirements was to have a mailing list. I decided to XSLT to transform "templates" to HTML so that editing was very easy and less time...
1
by: Rajesh | last post by:
I am trying to pass the namespace, which is in my Original Message, to a Java method for further processing. In the original message the xmlns:xenc namespace is present. I make a call to Java...
10
by: Andy Fish | last post by:
hi, I have an XSLT which is producing XML output. many of the nodes in the output tree contain namespace declarations for namespaces that are used in the source document even though they are...
6
by: kluge.wolfram | last post by:
Hi, i get stucked on a transformation problem using XSLT. What i need is to copy an XML Tree to an output XML without any automatic changes. Since i used <xsl:copyor <xsl:copy-ofthere occur...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.