初试XSL

    技术2022-05-11  104

    <?xml version="1.0" encoding="gb2312"?><!-- DWXMLSource="nihao.xml" --><!DOCTYPE xsl:stylesheet  [ <!ENTITY nbsp   " "> <!ENTITY copy   "©"> <!ENTITY reg    "®"> <!ENTITY trade  "™"> <!ENTITY mdash  "—"> <!ENTITY ldquo  "“"> <!ENTITY rdquo  "”">  <!ENTITY pound  "£"> <!ENTITY yen    "¥"> <!ENTITY euro   "€">]><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="html" encoding="gb2312" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/><xsl:template match="/"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"/><title>产品搜索结果</title></head>

    <body><h1>产品搜索结果</h1><p><b>摘要</b><xsl:value-of select="*/摘要"/></p><xsl:apply-templates select="产品搜索"/></body></html></xsl:template><xsl:template match="产品搜索"><table><tr><th>品名</th><th>定价</th><th>说明页</th></tr><xsl:for-each select="产品"><tr><td><xsl:value-of select="品名"/></td><td><xsl:value-of select="定价"/></td><td><a href="{说明页/@网址}"><xsl:value-of select="说明页"/></a></td></tr></xsl:for-each></table></xsl:template></xsl:stylesheet>l

    <?xml version="1.0" encoding="gb2312"?><?xsl-stylesheet type="text/xsl" href="xtom.xsl" ?><产品搜索><摘要>产品有两种:毛笔,笔记本</摘要><产品><货号>123456789</货号><品名>朗毛</品名><定价>234$</定价><说明页  网址="http://www.sina.com.cn">上市发布</说明页></产品><产品><货号>12345678</货号><品名>朗朗</品名><定价>232$</定价><说明页  网址="http://www.sina.com.cn">上市发布</说明页></产品></产品搜索>

    --------------

    测试用例


    最新回复(0)