如何解决XML和XSL文件输出为HTML文件
我有一个XML文件和一个XSL文件,我想获得一个HTML文件作为输出,但是我不完全知道如何继续获取格式正确的HTML文件。您是否有任何网站可以读取其工作原理? 此外,我发布代码可能已经犯了一些错误。
谢谢。
Natalie
XML文件
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="Test_4_css.xsl"?>
<tapete>
<category name="MOBILE ICONS">
<icon>
<assetid>001</assetid>
<title>car_setup</title>
</icon>
<icon>
<assetid>002</assetid>
<title>remote_car_status</title>
</icon>
<icon>
<assetid>003</assetid>
<title>remote_lock</title>
</icon>
</category>
<category name="HUMAN ICONS">
<icon>
<assetid>001</assetid>
<title>car_setup</title>
</icon>
<icon>
<assetid>002</assetid>
<title>remote_car_status</title>
</icon>
<icon>
<assetid>003</assetid>
<title>remote_lock</title>
</icon>
</category>
</tapete>
XSL文件
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles4.css"/>
</head>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="category">
<h2><xsl:value-of select="@name"/></h2>
<p>
<xsl:for-each select="icon"> 
<img150><xsl:value-of select="assetid"/></img150>
<xsl:value-of select="title"/>
</xsl:for-each>
</p>
</xsl:template>
</xsl:stylesheet>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。