Microsoft Developer Network >
Forums Home
>
Windows Live Developer Forums Forums
>
Multimap API Development Forum
>
Multimap Web Services help
Multimap Web Services help
Following the Multimap API V1.2 Web Services Documentation - Searching documentation but having some issues.
I have to use classic asp. I am grabbing the xml file, and xsl to output it.
EXAMPLE OF MY ASP CODE:
strURL=** my url with api key *** set oXMLhttp = Server.CreateObject("Microsoft.XMLHTTP") oXMLhttp.open "GET", strURL, False oXMLhttp.send set oXMLsource = Server.CreateObject("Microsoft.XMLDOM") oXMLsource.async = false oXMLsource.loadxml(oXMLhttp.responseText) set oXSL = Server.CreateObject("Microsoft.XMLDOM") oXSL.async = false oXSL.load(server.mappath("xsl/multimap.xsl")) ResultsFeed = oXMLsource.transformNode(oXSL) Response.Write(ResultsFeed)EXAMPLE OF MY XSL CODE:
I have been able to get this code to work if i remove xmlns="http://clients.multimap.com/API" from the RecordSets node. Otherwise it returns nothing. I am sure it is a bad idea to remove this.<?xml version="1.0" encoding="iso-8859-1" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" omit-xml-declaration="yes"/> <xsl:template match="/"> <table summary="api test" cellspacing="0"> <thead> <th scope="col">Distance</th> </thead> <tbody> <xsl:apply-templates select="//Record"></xsl:apply-templates> </tbody> </table> </xsl:template> <xsl:template match="Record"> <tr> <td> <xsl:value-of disable-output-escaping="yes" select="Distance/Miles"/>mi (<xsl:value-of disable-output-escaping="yes" select="Distance/KM"/>km) </td> </tr> </xsl:template> </xsl:stylesheet>
What am i doing wrong? I am sure I am doing something wrong.
Answers
i'm stripping it out before i load it. something like:
Looks like you are not denoting the use of "mm" to refer all Multimap elements. You need to prefix/qualify all Multimap elements in the stylesheet with ‘mm’. The top <xsl:stylesheet> element should denote the reference for "mm", for example - xmlns:mm='http://clients.multimap.com/API' .
strResponse=oXMLhttp.responseText
This works fine. Is it ok to strip out the Route node? All i am doing is outputting data from it.
//regex code to strip out Route node so it becomes <Route>
oXMLsource.loadxml(strResponse)
Please reference the information at the following link, this is the recommended and correct solution:-
http://lists.xml.org/archives/xml-dev/200105/msg00284.html
The following is an example of what the stylesheet should contain:-
<?xml version="1.0" encoding="iso-8859-1" ?>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mm="http://clients.multimap.com/API">
<xsl:output method="html" omit-xml-declaration="yes" />
- <xsl:template match="/">
- <table summary="api test" cellspacing="0">
- <thead>
<th scope="col">Distance</th>
</thead>
- <tbody>
<xsl:apply-templates select="//mm:Record" />
</tbody>
</table>
</xsl:template>
- <xsl:template match="mm:Record">
- <tr>
- <td>
<xsl:value-of disable-output-escaping="yes" select="mm:Distance/mm:Miles" />
mi (
<xsl:value-of disable-output-escaping="yes" select="mm:Distance/mm:KM" />
km)
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
We do not expect any issues if you would like to remove the namespace from the response XML so that you do not have to add the ‘mm’ prefix throughout the XSL, as long as there’s no conflict between the names of Multimap elements and the generic www.w3c.org elements. Users - Please use this method at your own risk.
- Marked As Answer byJohn-SheridanMSFT, ModeratorFriday, October 09, 2009 2:29 PM
All Replies
- Hi
We are not sure of the issue here, the RecordSets node and "xmlns="http://clients.multimap.com/API" is normally returned in the XML after the URL request, so how/where are you removing the xmlns attribute?
Thanks, John.
- i'm stripping it out before i load it. something like:
strResponse=oXMLhttp.responseText //regex code to strip out Route node so it becomes <Route> oXMLsource.loadxml(strResponse)
This works fine. Is it ok to strip out the Route node? All i am doing is outputting data from it. i'm stripping it out before i load it. something like:
Looks like you are not denoting the use of "mm" to refer all Multimap elements. You need to prefix/qualify all Multimap elements in the stylesheet with ‘mm’. The top <xsl:stylesheet> element should denote the reference for "mm", for example - xmlns:mm='http://clients.multimap.com/API' .
strResponse=oXMLhttp.responseText
This works fine. Is it ok to strip out the Route node? All i am doing is outputting data from it.
//regex code to strip out Route node so it becomes <Route>
oXMLsource.loadxml(strResponse)
Please reference the information at the following link, this is the recommended and correct solution:-
http://lists.xml.org/archives/xml-dev/200105/msg00284.html
The following is an example of what the stylesheet should contain:-
<?xml version="1.0" encoding="iso-8859-1" ?>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mm="http://clients.multimap.com/API">
<xsl:output method="html" omit-xml-declaration="yes" />
- <xsl:template match="/">
- <table summary="api test" cellspacing="0">
- <thead>
<th scope="col">Distance</th>
</thead>
- <tbody>
<xsl:apply-templates select="//mm:Record" />
</tbody>
</table>
</xsl:template>
- <xsl:template match="mm:Record">
- <tr>
- <td>
<xsl:value-of disable-output-escaping="yes" select="mm:Distance/mm:Miles" />
mi (
<xsl:value-of disable-output-escaping="yes" select="mm:Distance/mm:KM" />
km)
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
We do not expect any issues if you would like to remove the namespace from the response XML so that you do not have to add the ‘mm’ prefix throughout the XSL, as long as there’s no conflict between the names of Multimap elements and the generic www.w3c.org elements. Users - Please use this method at your own risk.
- Marked As Answer byJohn-SheridanMSFT, ModeratorFriday, October 09, 2009 2:29 PM

