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

    >> 本版讨论XSL,XSLT,XSL-FO,CSS等技术
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - XML技术『 XSL/XSLT/XSL-FO/CSS 』 → [求助]关于XSL中参数的问题,哪位老大可以接受挑战 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 3338 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: [求助]关于XSL中参数的问题,哪位老大可以接受挑战 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     cater 美女呀,离线,快来找我吧!
      
      
      等级:大一新生
      文章:0
      积分:54
      门派:XML.ORG.CN
      注册:2004/4/29

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给cater发送一个短消息 把cater加入好友 查看cater的个人资料 搜索cater在『 XSL/XSLT/XSL-FO/CSS 』的所有贴子 引用回复这个贴子 回复这个贴子 查看cater的博客楼主
    发贴心情 [求助]关于XSL中参数的问题,哪位老大可以接受挑战

    哪位高手帮忙看看,下边这段传参的代码哪儿有问题,如果想在页面的最下边显示,应放在
    整个程序的哪个位置:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    传参的代码:
    <xsl:template match="/">
    <table width="40%" align="center" border="2" bgcolor="F6B94E">
      
    <tr> 
     <xsl:variable name="Test">中国最佳女演员评比结果:</xsl:variable>
     <xsl:value-of select="$Test"/>
        <p>
        观众投票最多者:
        </p>
       <xsl:call-template name="最有气质女演员:"/>
        评比结果是:
       <xsl:call-template name="最有气质女演员:">
     <xsl:with-param name="Star">刘嘉玲</xsl:with-param>
       </xsl:call-template>
       
         <xsl:output method="xml"/>

         <xsl:template name="最有气质女演员" match="best">
              <xsl:param name="Star">李嘉欣 </xsl:param>
        <p>
       最有气质女演员:
       <xsl:value-of select="$Star"/>
       </p>
        </xsl:template>  
    </tr>
    </table> 
    </xsl:template > 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~``

    整体程序(XSL):

    <?xml version="1.0" encoding="GB2312"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
    <xsl:template>
    <xsl:apply-templates/>
    </xsl:template>
    <xsl:template match="china">

    <table width="80%" align="center" border="3">
    <span  style="font-size:30pt;
                     color:EA0437;
                     font-weight:bolder;
                     display:block;
                     text-align:center;
                     background-image: url(im2.gif);
                 "><p></p><br>新 片 预 告</br><p></p></span></table>
              
    <table width="80%"  align="center" border="3">
    <span  style="font-size:14pt;
                     color:F8963E;
                     font-weight:bolder;
                     display:block;
                     text-align:left;
                     background-image: url(db.gif);
                     background-position-vertical:50%;
                 ">中国影片</span></table>
        
    <table width="80%" align="center" border="1" bgcolor="CFF328" >
    <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="20%">主  演</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[.='刮痧']">
    <b><xsl:value-of /></b>
    </xsl:template>
    <xsl:template match="name[.='海上花']">
    <b><xsl:value-of /></b>
    </xsl:template>
    <xsl:template match="name[.='幸福时光']">
    <b><xsl:value-of /></b>
    </xsl:template>
    <!--xsl:if 进行筛选  -->
    <xsl:template match="director">
    <xsl:if match=".[.='郑晓龙']">
    <i><xsl:value-of /></i>
    </xsl:if>
    <xsl:if match=".[.='侯孝贤']">
    <i><xsl:value-of /></i>
    </xsl:if>
    <xsl:if match=".[.='张艺谋']">
    <i>
    <xsl:value-of />
    </i>
    </xsl:if>
    </xsl:template>

    <xsl:template match="foreign">          
    <table width="80%"  align="center" border="3">
    <span  style="font-size:14pt;
                     color:F8963E;
                     font-weight:bolder;
                     display:block;
                     text-align:left;
                     background-image: url(db1.gif);
                     background-position-vertical:50%;
                 ">外国影片</span></table>
    <table width="80%" align="center" border="1" bgcolor="86A8F3">
    <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="20%">主  演</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[.='情书']">
    <b><xsl:value-of /></b>
    </xsl:template>
    <xsl:template match="name[.='勇敢的心']">
    <b><xsl:value-of /></b>
    </xsl:template>
    <xsl:template match="name[.='辛德勒的名单']">
    <b><xsl:value-of /></b>
    </xsl:template>
    <!--xsl:if 进行筛选  -->

    <xsl:template match="director[.='岩井俊二']">
    <i><xsl:value-of /></i>
    </xsl:template>

    <xsl:template match="director[.='梅尔.吉布森']">
    <i><xsl:value-of /></i>
    </xsl:template>

    <xsl:template match="director[.='斯皮尔博格']">
    <i><xsl:value-of /></i>
    </xsl:template>
                 
    <xsl:template match="stars">
    <xsl:value-of />
    </xsl:template>
    <!--利用xsl:choose结合xsl:when xsl:otherwise进行筛选-->
    <xsl:template match="review">
    <xsl:choose>
    <!--利用xsl:when通过属性值进行筛选-->
    <xsl:when test=".[@num='1']">
    <xsl:value-of />
    </xsl:when>
    <xsl:when test=".[@num='2']">
    <xsl:value-of />
    </xsl:when>
    <!--利用xsl:otherwise处理其他的元素-->
    <xsl:otherwise>
    <xsl:value-of />
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    </xsl:stylesheet>

    我的QQ是42319293,邮箱是squellct1@163.com 若有结果请与我联系 谢谢


       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2004/5/8 21:46: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/5/9 22:36:17

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

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