I have project that I'm currently trying to customize. I'm trying to create store locator application using HTML and calling a url to output data with a XML format.
我有一个项目,我正在尝试自定义。我正在尝试使用HTML创建商店定位器应用程序并调用url以XML格式输出数据。
The input form I'm using accepts parameters:
我正在使用的输入表单接受参数:
<!DOCTYPE html>
<html>
<head>
<title>Store Locator</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
</head>
<body>
<div align="center">
<form action="SmartHomePage2.html" method="post">
<table cellspacing="5">
<tr>
<td colspan="2" align="center">
<h2>Store Locator</h2>
</td>
</tr>
<tr>
<td align="right">
Enter Your Zip Code:
</td>
<td>
<input type="text" name="zip" value="" />
</td>
</tr>
<tr>
<td align="right">
Enter the search radius in miles:
</td>
<td>
<input type="text" name="dist" value="" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Search" />
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
And here is what my output page looks like:
这是我的输出页面的样子:
<!DOCTYPE html>
<html>
<head>
<title>Search Results</title>
</head>
<body>
<h1>Best Buy Results</h1>
<c:import url="http://api.remix.bestbuy.com/v1/stores(area
(${param.zip},${param.dist}))?show=storeId,name,distance,lat,lng
&apiKey=ruuk8c4ux2p4e7d6bfftzuda" var="message" />
<x:parse var="a" doc="${message}" />
<x:forEach var="current" select="$a/stores/store">
<b> Store ID: </b> <x:out select="$current/storeId" />
<br />
<b> Name: </b> <x:out select="$current/name" />
<br />
<b> Distance: </b> <x:out select="$current/distance" />
<br />
<b> Latitude: </b> <x:out select="$current/lat" />
<br />
<b> Longitude: </b> <x:out select="$current/lng" />
<br />
</li>
</ul>
</x:forEach>
</body>
</html>
My question would be how to output XML data with HTML? Or do I need to incorporate some JavaScript?
我的问题是如何用HTML输出XML数据?或者我需要合并一些JavaScript?
Thank you in advance.
先谢谢你。
1 个解决方案
#1
0
You can do this by using XSL, here's a good explanation and example.
你可以通过使用XSL来做到这一点,这是一个很好的解释和例子。
Converting XML to HTML using XSL
使用XSL将XML转换为HTML
#1
0
You can do this by using XSL, here's a good explanation and example.
你可以通过使用XSL来做到这一点,这是一个很好的解释和例子。
Converting XML to HTML using XSL
使用XSL将XML转换为HTML