新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> 关于 XML 的一般性技术讨论,提供 XML入门资料 和 XML教程
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - XML技术『 XML基础 』 → [求助]Required attribute 'match' is missing,疑惑中...... 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 3640 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: [求助]Required attribute 'match' is missing,疑惑中...... 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     whittiy07 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:2
      积分:58
      门派:XML.ORG.CN
      注册:2008/3/18

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给whittiy07发送一个短消息 把whittiy07加入好友 查看whittiy07的个人资料 搜索whittiy07在『 XML基础 』的所有贴子 引用回复这个贴子 回复这个贴子 查看whittiy07的博客楼主
    发贴心情 [求助]Required attribute 'match' is missing,疑惑中......

    错误为:The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    --------------------------------------------------------------------------------
    Required attribute 'match' is missing.

    文件为film.xml:
    <?xml version="1.0" encoding="gb2312"?>
    <?xml-stylesheet type="text/xsl" href="film.xsl" ?>

    <root>
    <china>
    <film>
    <name>刮痧</name>
    <director>郑晓龙</director>
    <review>一部反映东西文化冲突、而又相互融合的影片</review>
    <stars>梁家辉</stars>
    <stars>蒋雯丽</stars>
    </film>
    <film>
    <name>幸福时光</name>
    <director>张艺谋</director>
    <review>张艺谋的最新作品</review>
    <stars>赵本山</stars>
    <stars>董洁</stars>
    </film>
    </china>
    <foreign>
    <film>
    <name>勇敢的心</name>
    <director>梅尔.吉布森</director>
    <review>苏格兰的民族英雄威廉.华莱士的故事</review>
    <stars>梅尔.吉布森</stars>
    <stars>索菲.玛索</stars>
    </film>
    <film>
    <name>辛德勒的名单</name>
    <director>斯皮尔伯格</director>
    <review>二次世界大战期间,企业家辛德勒救助集中营中的犯人的故事</review>
    <stars>利亚姆.尼森</stars>
    <stars>本.金斯</stars>
    </film>
    </foreign>
    </root>

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

    film.xsl:

    <?xml version="1.0" encoding="gb2312"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" />

    <xsl:template>
    <xsl:apply-templates />
    </xsl:template>

    <xsl:template match="china">
    <span style="font-size:14pt; color:red; font-weight:bolder;
    display:block; text-align:center;">中国影片</span>
    <table width="80%" align="center" border="1">
    <xsl:for-each select="film">
    <tr>
      <td colspan="1" width="20%">片名</td>
      <td colspan="3"><xsl:apply-templates select="name" /></td>
    </tr>
    <tr>
      <td>导演</td>
      <td width="20%"><xsl:apply-templates select="director" /></td>
      <td width="10%">主演</td>
      <td><xsl:apply-templates select="stars" /></td>
    </tr>
    <tr>
      <td>内容简介</td>
      <td colspan="3"><xsl:apply-templates select="review" /></td>
    </tr>
    </xsl:for-each>
    </table>
    </xsl:template>

    <xsl:template match="foreign">
    <span style="font-size:14pt; color:red; font-weight:bolder;
    display:block; text-align:center;">外国影片</span>
    <table width="80%" align="center" border="1">
    <xsl:for-each select="film">
    <tr>
      <td colspan="1" width="20%">片名</td>
      <td colspan="3"><xsl:apply-templates select="name" /></td>
    </tr>
    <tr>
      <td>导演</td>
      <td width="20%"><xsl:apply-templates select="director" /></td>
      <td width="10%">主演</td>
      <td><xsl:apply-templates select="stars" /></td>
    </tr>
    <tr>
      <td>内容简介</td>
      <td colspan="3"><xsl:apply-templates select="review" /></td>
    </tr>
    </xsl:for-each>
    </table>
    </xsl:template>

    <!-- 定义最底层的模板 -->
    <xsl:template match="name">
    <xsl:value-of />
    </xsl:template>
    <xsl:template match="director">
    <xsl:value-of />
    </xsl:template>
    <xsl:template match="stars">
    <xsl:value-of />
    </xsl:template>
    <xsl:template match="review">
    <xsl:value-of />
    </xsl:template>

    </xsl:stylesheet>


    这是怎么回事?刚学xml,求教高手解答。


       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/3/24 19:44:00
     
     whittiy07 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:2
      积分:58
      门派:XML.ORG.CN
      注册:2008/3/18

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给whittiy07发送一个短消息 把whittiy07加入好友 查看whittiy07的个人资料 搜索whittiy07在『 XML基础 』的所有贴子 引用回复这个贴子 回复这个贴子 查看whittiy07的博客2
    发贴心情 
    问题所在:
    <xsl:template match="china">路径不对,修改为match="root/china"
    同理,foreign类似,终于找到了,看来初学xml的时候找到一本好的教材实在是太重要了。
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/3/25 12:43:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 XML基础 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2025/9/7 6:40:30

    本主题贴数2,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    62.500ms