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

    >> 本版讨论XSL,XSLT,XSL-FO,CSS等技术
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - XML技术『 XSL/XSLT/XSL-FO/CSS 』 → xml文件经翻译后页面显示完成但是空白没有东东是怎么回事? 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 4505 个阅读者浏览上一篇主题  刷新本主题   平板显示贴子 浏览下一篇主题
     * 贴子主题: xml文件经翻译后页面显示完成但是空白没有东东是怎么回事? 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     Cindylm 美女呀,离线,快来找我吧!
      
      
      等级:大一(猛啃高等数学)
      文章:19
      积分:120
      门派:XML.ORG.CN
      注册:2004/4/25

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给Cindylm发送一个短消息 把Cindylm加入好友 查看Cindylm的个人资料 搜索Cindylm在『 XSL/XSLT/XSL-FO/CSS 』的所有贴子 引用回复这个贴子 回复这个贴子 查看Cindylm的博客楼主
    发贴心情 

    xml文件:
    <?xml version="1.0" encoding="GB2312"?>
    <?xml:stylesheet type="text/xsl" href="component.xsl"?>
    <page>
     <head>
      <title>组件测试</title>
     </head>
     <body>
      <bgcolor>#66CCFF</bgcolor>

      <component>
       
       <ButtonType>
        <id>button1</id>
        <value>提示</value>
        <type>button</type>
        <onclickevent>have()</onclickevent>
       </ButtonType>
      </component>

      <component>
       
       <StaticTextType>
        <id>text1</id>
        <size>6</size>
        <content>测试成功</content>
       </StaticTextType>
      </component>

     </body>

    </page>

    xsl文件:
    <?xml version="1.0" encoding="GB2312"?>

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <!--根模板-->
    <xsl:template match="/">
     <html>
       <head>
        <title><xsl:value-of select="title"/></title>
       </head>
       
      
      
       <xsl:apply-templates select="body"/>
      
     </html>
    </xsl:template>

    <!--body模板-->
    <xsl:template match="body">
     <body>
     <bgcolor><xsl:value-of select="bgcolor"/></bgcolor>
     <xsl:apply-templates select="component"/>
     </body>
    </xsl:template>

    <!--component模板-->
    <xsl:template match="component">
        <xsl:for-each  select="*">
            <xsl:choose>
                 <xsl:when test="starts-with(.,'Button')">
      <xsl:apply-templates  select="ButtonType"/>
                 </xsl:when>
                 <xsl:when test="starts-with(.,'StaticText')">
      <xsl:apply-templates  select=" StaticTextType"/>
                 </xsl:when>
            </xsl:choose>
        </xsl:for-each>
    </xsl:template>

    <!--button模板-->
    <xsl:template match="ButtonType">
       <xsl:element name="input">
           <xsl:attribute name="name"><xsl:value-of select="id"/>
           </xsl:attribute>
          <xsl:attribute name="type"><xsl:value-of select="type"/>
          </xsl:attribute>
          <xsl:attribute name="value"><xsl:value-of select="value"/>
          </xsl:attribute>
       </xsl:element>
    </xsl:template>

    <!--Text模板-->
    <xsl:template match="StaticTextType">
       <xsl:element name="input">
           <xsl:attribute name="name"><xsl:value-of select="id"/>
           </xsl:attribute>
          <xsl:attribute name="size"><xsl:value-of select="size"/>
          </xsl:attribute>
          <xsl:attribute name="value"><xsl:value-of select="content"/>
          </xsl:attribute>
       </xsl:element>
    </xsl:template>

    </xsl:stylesheet>

    问题出在哪儿呢。。。?

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2004/4/29 9:15:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 XSL/XSLT/XSL-FO/CSS 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/6/6 4:37:16

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

     *树形目录 (最近20个回帖) 顶端 
    主题:  xml文件经翻译后页面显示完成但是空白没有东东是怎么回事?(152字) - Cindylm,2004年4月28日
        回复:  我以前也碰到这样的问题,大多因为Match定位错误,找不到数据所致(61字) - wh010607,2004年4月29日
        回复:  <?xml version="1.0" encoding="GB2312"?><xsl:sty..(1816字) - sam,2004年4月29日
        回复:  标题显示的出来,但是页面仍然是空白的(36字) - Cindylm,2004年4月29日
        回复:  <?xml version="1.0" encoding="GB2312"?><xsl:sty..(1804字) - sam,2004年4月29日
        回复:  xml文件:<?xml version="1.0" encoding="GB2312"?><?..(2364字) - Cindylm,2004年4月29日
        回复:  因为代码写错了呗..贴出来让大家给你找找问题吧(50字) - admin,2004年4月29日

    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    78.125ms