0
我是使用XSL和XML的初学者。我在从XML文档中获取数据并在XSL中使用它时遇到了问题。目前我正在尝试不同的方法,但似乎无法做到正确,我将需要使用此技术来完成项目。一旦我可以做到这一点,我将能够在整个页面上做到。将xml文档中的数据插入到xsl中
这里是我的XML样本和我的XSL文件:
<storelocator>
<!--Parent element containing all text on the page-->
<content_text>
<title>
<titlename>Store Locator</titlename>
</title>
<title>
<subtitle>FIND A STORE</subtitle>
</title>
<title>
<countrydropdown>Country</countrydropdown>
</title>
<title>
<address>Steet Address, City, Sate/Province OR Postal/Zip Code</address>
</title>
<title>
<radiusdropdown>Radius</radiusdropdown>
</title>
<title>
<featuredstore>FEATURED STORE</featuredstore>
</title>
<title>
<storelocation>Newbury Street, Boston, MA USA</storelocation>
</title>
</storelocator>
这里是XSL:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body bgcolor="white">
<div id="container" style="100%">
<div id="header" style="background: url('header.png'); height:30px;"></div>
<div id="content_container" align="center" style="text-transform: uppercase; font-family: tahoma; font-weight: normal; font-size: 0.8em">
<div id="content" align="left" style="background-color:blue;height:845px;width:848px">
<xsl:value-of select="titlename"/> <!--here I was trying to import the text from XML DOC-->
<br/>
<br/>
<br/>
<img src="image.png" align="left"/><br/>
<br/>
<br/>
<br/>
<br/>
</div>
</div>
<div id="footer" style="background-color:black;clear:both;text-align:center;height:20px"></div>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
基本上什么,我试图做的是进口的“商店定位器”称号等等它显示在图像上方,但在浏览器中打开时目前没有任何显示。我非常感谢一些帮助,因为我一直在试图做一些。
谢谢这个工作X – Ibrahim
@Ibrahim - 非常欢迎。 +1是一个很好的问题。 –