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

    >> 本版讨论XSL,XSLT,XSL-FO,CSS等技术
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - XML技术『 XSL/XSLT/XSL-FO/CSS 』 → 求助XSLT转换问题!急呀! 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 1450 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: 求助XSLT转换问题!急呀! 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     菜鸟上线 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:5
      积分:76
      门派:XML.ORG.CN
      注册:2005/1/31

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

    最近小弟在做毕业设计,一个基于XML数据库的WEB授课课件系统,但是本人是第一次学习XML,在所做过程中遇到了一些小麻烦,请大家帮忙解决一下!谢谢!
    我的XML如下:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <?xml-stylesheet type="text/xsl" href="PMS_Help.xsl"?>
    <PMS_Help>
     <Item>
      <Name>cpu</Name>
      <Para>大家好</Para>
      <Image small="clsdfold.bmp">copen.bmp</Image>
      <Para>你好</Para>
      <Para>我好</Para>
      <Item>
       <Name>欢迎大家</Name>
       <Item>
        <Name>Welcome</Name>
        <Para>大家好</Para>
        <Image small="clsdfold.bmp">copen.bmp</Image>
        <Para>你好</Para>
        <Para>我好</Para>
       </Item>
       <Item>
        <Name>大家好</Name>
        <Para>湖南大学好</Para>
        <Image small="clsdfold.bmp">copen.bmp</Image>
        <Para>软件学院</Para>
        <Para>湖南大学软件学院</Para>
       </Item>
      </Item>
      <Item>
       <Name>陈能</Name>
       <Para>段革新</Para>
       <Image small="copen.bmp">clsdfold.bmp</Image>
       <Para>李泉</Para>
       <Para>李子</Para>
      </Item>
     </Item>
     <Item>
      <Name>段革新</Name>
      <Para>陈能</Para>
      <Image small="copen.bmp">clsdfold.bmp</Image>
      <Para>李泉</Para>
      <Para>李子</Para>
     </Item>
    </PMS_Help>
    xsl如下:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
     <xsl:template match="PMS_Help">
      <html>
       <head>
        <title>计算机微机与软维护授课课件</title>
        <style media="screen, print">
         <xsl:comment><![CDATA[
          body {font-fimaly:'宋体',Arial; font-size:9pt; color:#000000;}
          .Title1 {font-fimaly:'宋体'; font-size:17.2pt; color:#333333; font-weight:bold; margin-left:0pt; background-color:#eeeeee; white-space: nowrap}
          .Title2 {font-fimaly:'宋体'; font-size:14pt; color:#000000; font-weight:bold; margin-left:0pt; white-space: nowrap}
          .Title3 {font-fimaly:'宋体'; font-size:12pt; color:#333333; font-weight:bold; margin-left:90pt; background-color:#eeeeee; white-space: nowrap}
          .Title4 {font-fimaly:'宋体'; font-size:12pt; color:#000000; font-weight:bold; margin-left:90pt; white-space: nowrap}
          .Title5 {font-fimaly:'宋体'; font-size:10pt; color:#333333; font-weight:bold; margin-left:160pt; background-color:#eeeeee; white-space: nowrap}
          .Title6 {font-fimaly:'宋体'; font-size:10pt; color:#000000; font-weight:bold; margin-left:160pt; white-space: nowrap}
          .Para1 {font-fimaly:'宋体'; font-size:9pt; color:#333333; margin-left:90pt}
          .Para2 {font-fimaly:'宋体'; font-size:9pt; color:#333333; margin-left:90pt}
          .Para3 {font-fimaly:'宋体'; font-size:9pt; color:#333333; margin-left:90pt}
          .Para4 {font-fimaly:'宋体'; font-size:9pt; color:#333333; margin-left:90pt}
          .Para5 {font-fimaly:'宋体'; font-size:9pt; color:#333333; margin-left:160pt}
          .Para6 {font-fimaly:'宋体'; font-size:9pt; color:#333333; margin-left:160pt}
          .image {cursor:hand}]]></xsl:comment>
        </style>
        <script>
         <xsl:comment><![CDATA[
          /* 当用户点击图片时,交替显示缩略图和全图 */
          function swapImg(which, small, normal){
           var s = "/";
           //alert(which + '|' + small + '|' + normal);
           //alert(which.src.substring(which.src.lastIndexOf(s)+1));
           if (which.src.substring(which.src.lastIndexOf(s)+1) == small){
            which.src = '../image/' + normal;
            which.alt = '===> 缩小 <===';
           }
           else{
            which.src = '../image/' + small;
            which.alt = '<=== 放大 ===>';
           }
          }
         ]]></xsl:comment>
        </script>
       </head>
       <body>
        <a name="top"/>
        <h2>计算机微机与软维护</h2>
        <p align="right">
         <a href="mailto:duangexin@etang.com">EMail to us</a>
         <xsl:text> </xsl:text>
         <a href="javascript:print()">打印本手册</a>
        </p>
        <xsl:for-each select="Item">
         <xsl:apply-templates select="."/>
        </xsl:for-each>
       </body>
      </html>
     </xsl:template>
     <xsl:template match="Item">
      <xsl:variable name="allParentNode" select="ancestor::Item/Name"/>
      <xsl:variable name="allChildNode" select="child::Item/Name"/>
      <xsl:variable name="numOfAllParentNode" select="count($allParentNode) + 1"/>
      <xsl:variable name="numOfAllChildNode" select="count($allChildNode)"/>
      <!-- output the content of help -->
      <!-- 显示各级标题 -->
      <xsl:element name="a">
       <xsl:attribute name="name"><xsl:number count="Item" level="multiple" format="01-01-01"/></xsl:attribute>
      </xsl:element>
      <xsl:element name="div">
       <xsl:attribute name="class"><xsl:value-of select="concat('Title', $numOfAllParentNode)"/></xsl:attribute>
       <xsl:number count="Item" level="multiple"/>
       <xsl:text> </xsl:text>
       <xsl:value-of select="Name"/>
       <!-- 级别为奇数的标题下加横线 -->
       <xsl:if test="$numOfAllParentNode = 1 or ($numOfAllParentNode mod 2) != 0">
        ::<a href="#top" target="_self">top</a>
        <hr size="1" noshade="noshade"/>
       </xsl:if>
      </xsl:element>
      <p/>
      <!-- 如果还存在下一级Item,则递归调用此模板 -->
      <xsl:if test="count(Item)>0">
       <xsl:apply-templates select="Item"/>
      </xsl:if>
      <!-- 如果不存在下一级标题,显示段落和图片内容 -->
      <xsl:if test="count(Item)=0">
       <xsl:apply-templates select="Para | Image"/>
      </xsl:if>
     </xsl:template>
     <xsl:template match="Para | Image">
      <xsl:variable name="allParentNode" select="ancestor::Item/Name"/>
      <xsl:variable name="numOfAllParentNode" select="count($allParentNode) + 1"/>
      <!-- 如果节点是Para,显示段落 -->
      <xsl:if test="self::Para">
       <xsl:element name="div">
        <xsl:attribute name="class"><xsl:value-of select="concat('Para', $numOfAllParentNode)"/></xsl:attribute>
        <p>
         <xsl:value-of select="."/>
        </p>
       </xsl:element>
      </xsl:if>
      <!-- 如果节点是Image,显示图片 -->
      <xsl:if test="self::Image">
       <xsl:variable name="small" select="normalize-space(@small)"/>
       <xsl:variable name="normal" select="normalize-space(.)"/>
       <xsl:element name="div">
        <xsl:attribute name="class"><xsl:value-of select="concat('Para', $numOfAllParentNode)"/></xsl:attribute>
        <xsl:element name="img">
         <xsl:choose>
          <xsl:when test="boolean($small)">
           <xsl:attribute name="src">../image/<xsl:value-of select="$small"/></xsl:attribute>
           <xsl:attribute name="alt">&lt;=== 放大 ===&gt;</xsl:attribute>
           <xsl:attribute name="onclick"><xsl:value-of select="concat('swapImg(this, &quot;',$small,'&quot;,&quot;',$normal,'&quot;)')"/></xsl:attribute>
          </xsl:when>
          <xsl:when test="not(boolean($small))">
           <xsl:attribute name="src">../image/<xsl:value-of select="$normal"/></xsl:attribute>
          </xsl:when>
         </xsl:choose>
         <xsl:attribute name="class">image</xsl:attribute>
         <xsl:attribute name="border">0</xsl:attribute>
        </xsl:element>
        <p/>
       </xsl:element>
      </xsl:if>
     </xsl:template>
    </xsl:stylesheet>

    问题:
    1.怎么我的图片无法显示?请问我哪里出错了?
    2.怎么章下面的概述内容无法显示?只能显示节下面的内容?


       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/4/22 9: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的博客广告
    2025/9/29 8:39:51

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

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