以文本方式查看主题 - 中文XML论坛 - 专业的XML技术讨论区 (http://bbs.xml.org.cn/index.asp) -- 『 XSL/XSLT/XSL-FO/CSS 』 (http://bbs.xml.org.cn/list.asp?boardid=8) ---- 在xslt里使用<xsl:apply-templates/>显示的问题 (http://bbs.xml.org.cn/dispbbs.asp?boardid=8&rootid=&id=6635) |
-- 作者:wedge -- 发布时间:4/11/2004 3:32:00 PM -- 在xslt里使用<xsl:apply-templates/>显示的问题 city.xml **************************************** <?xml version="1.0" encoding="gb2312"?> <?xml-stylesheet type="text/xsl" href="city.xslt"?> <China> <State id="1" name="江西"> <City>九江</City> <City>南昌</City> <City>庐山</City> <City>景德镇</City> </State> <State id="2" name="北京"> <City>北京西</City> <City>居庸关</City> <City>清华园</City> <City>周口店</City> </State> <State id="3" name="福建"> <City>福州</City> <City>厦门</City> <City>漳州</City> </State> <State id="4" name="甘肃"> <City>兰州</City> <City>洛门</City> <City>嘉峪关</City> </State> <State id="5" name="广东"> <City>广州</City> <City>深圳</City> <City>东莞</City> <City>石牌</City> </State> <State id="6" name="安徽"> <City>合肥</City> <City>黄山</City> <City>九龙岗</City> <City>马鞍山</City> </State> </China> ****************** city.xslt ********************** <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head> <title/> </head> <body> <table width="100%" border="1"> <xsl:apply-templates/> </table> </body> </html> </xsl:template> <xsl:template match="state"> <tr><td> <xsl:value-of select="city"/> </td></tr> </xsl:template> </xsl:stylesheet> ******************************************** 显示出来的XML格式不在表格里啊!?????? 问题出在哪了?请指点! |
-- 作者:296458 -- 发布时间:4/12/2004 11:06:00 AM -- <body> <table width="100%" border="1"> <xsl:apply-templates/> </table> </body> 应是<body> <table width="100%" border="1"> <xsl:apply-templates select="state"/> </table> </body> |
-- 作者:wedge -- 发布时间:4/12/2004 7:42:00 PM -- 改过来了,但什么都显示不出来了?? |
-- 作者:sam -- 发布时间:4/12/2004 11:39:00 PM -- 你的xml中第一个字母都是大写,xsl中都是小写 还有应该是<xsl:apply-templates select="//State"/> |
-- 作者:wedge -- 发布时间:4/13/2004 3:26:00 PM -- 谢谢sam了,我知道了,xslt也是XML文件,区分大小写的! 这是我修改后的,可以显示全部的城市了! 谢谢! <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head> <title/> </head> <body> <table width="100%" border="1"> <xsl:apply-templates select="//State"/> </table> </body> </html> </xsl:template> <xsl:template match="State"> <tr><td> <xsl:apply-templates select="//City"/> </td></tr> </xsl:template> <xsl:template match="City"> <tr><td> <xsl:value-of select="."/> </td></tr> </xsl:template> </xsl:stylesheet> |
-- 作者:robert -- 发布时间:4/14/2004 4:51:00 PM -- 恩,我从这个里面学到了点东西
|
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
62.500ms |