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

    >> 本版讨论XSL,XSLT,XSL-FO,CSS等技术
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - XML技术『 XSL/XSLT/XSL-FO/CSS 』 → 求助:单选框(Radiobutton)和多选框(Checkbox)的显示! 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 2342 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: 求助:单选框(Radiobutton)和多选框(Checkbox)的显示! 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     mymygirl 美女呀,离线,快来找我吧!
      
      
      等级:大一新生
      文章:8
      积分:87
      门派:XML.ORG.CN
      注册:2004/4/17

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

    正在编一个调查表的转换程序,用XSLT将一个调查表的XML文档转换成XSL-FO,然后再生成PDF文件,中间有一些单选和多选的问答,要以表格的方式显示,那么在XSL-FO里是怎么表示
    单选框(RadioButton)和多选框(Checkbox)呢?

    请各位大虾帮忙!多谢啦!


       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2004/6/20 19:56:00
     
     宇宙人 帅哥哟,离线,有人找我吗?狮子座1981-8-20
      
      
      威望:4
      等级:大一新生
      文章:96
      积分:771
      门派:W3CHINA.ORG
      注册:2004/4/22

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给宇宙人发送一个短消息 把宇宙人加入好友 查看宇宙人的个人资料 搜索宇宙人在『 XSL/XSLT/XSL-FO/CSS 』的所有贴子 引用回复这个贴子 回复这个贴子 查看宇宙人的博客2
    发贴心情 
    在xslt中我这么写的!
    原xml文件:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by zqm (ihep) -->
    <?xml-stylesheet type="text/xsl" href= "mystyle.xsl"?>
    <Survey>
     <head>
      <discription bold="true" italic="true" underline="true" color="rgb(255,0,255)" fontsize="30">某产品调查问卷
    </discription>
     </head>
     <singal_choice id="1">
      <title bold="true" italic="false" underline="flase" color="rgb(0,0,255)" fontsize="20">你是否使用过本产品?
    </title>
      <choice bold="flase" italic="flase" underline="flase" color="rgb(0,0,0)" fontsize="20"> 是
    </choice>
      <choice bold="flase" italic="flase" underline="flase" color="rgb(0,0,0)" fontsize="20"> 否
    </choice>
     </singal_choice>
     <multy_choice id="2">
      <title bold="true" italic="flase" underline="flase" color="rgb(0,0,255)" fontsize="20">你认为本产品有那些缺点?
    </title>
      <choice bold="flase" italic="flase" underline="flase" color="rgb(0,0,0)" fontsize="20"> 价格高
    </choice>
      <choice bold="flase" italic="flase" underline="flase" color="rgb(0,0,0)" fontsize="20"> 性能差
    </choice>
      <choice bold="flase" italic="flase" underline="flase" color="rgb(0,0,0)" fontsize="20"> 质量差
    </choice>
     </multy_choice>
     <short_answer id="3">
      <title bold="true" italic="flase" underline="flase" color="rgb(0,0,255)" fontsize="20">你不使用本产品的原因是?
    </title>
     </short_answer>
    </Survey>

    对应的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>问卷调查</title>
       </head>
       <body>
        <xsl:for-each select="Survey">
         <!--调查问卷的题目-->
         <xsl:for-each select="head">
          <div align="center">
           <span>
            <xsl:attribute name="style"><xsl:if test="discription[@italic='true']">
          font-style:italic;
          </xsl:if><xsl:if test="discription[@bold='true']">
          font-weight:bold;
                          </xsl:if>
          font-size:<xsl:value-of select="discription/@fontsize"/>pt;
          color:<xsl:value-of select="discription/@color"/>;
          </xsl:attribute>
            <xsl:choose>
             <xsl:when test="discription[@underline='true']">
              <u>
               <xsl:value-of select="discription"/>
              </u>
             </xsl:when>
             <xsl:otherwise>
              <xsl:value-of select="discription"/>
             </xsl:otherwise>
            </xsl:choose>
           </span>
          </div>
         </xsl:for-each>
         <hr/>
         <form action="post.asp" method="post">
         <table align="center" border="0" width="60%">
          <!--单选问题]-->
          <xsl:for-each select="singal_choice">
           <!--问题题目]-->
           <tr>
            <span>
             <xsl:attribute name="style"><xsl:if test="title[@italic='true']">
          font-style:italic;
          </xsl:if><xsl:if test="title[@bold='true']">
          font-weight:bold;
                          </xsl:if>
          font-size:<xsl:value-of select="title/@fontsize"/>pt;
          color:<xsl:value-of select="title/@color"/>;
          </xsl:attribute>
             <xsl:choose>
              <xsl:when test="title[@underline='true']">
               <u>
                <xsl:value-of select="@id"/>.<xsl:value-of select="title"/>
               </u>
              </xsl:when>
              <xsl:otherwise>
               <xsl:value-of select="@id"/>.<xsl:value-of select="title"/>
              </xsl:otherwise>
             </xsl:choose>
            </span>
           </tr>
           <!--问题选项]-->
           <!--选项一]-->
           <tr>
            <input type="radio" name="singal" value="yes"/>
            <span>
             <xsl:attribute name="style"><xsl:if test="choice[1][@italic='true']">
          font-style:italic;
          </xsl:if><xsl:if test="choice[1][@bold='true']">
          font-weight:bold;
                          </xsl:if>
          font-size:<xsl:value-of select="choice[1]/@fontsize"/>pt;
          color:<xsl:value-of select="choice[1]/@color"/>;
          </xsl:attribute>
             <xsl:choose>
              <xsl:when test="choice[1][@underline='true']">
               <u>
                <xsl:value-of select="choice[1]"/>
               </u>
              </xsl:when>
              <xsl:otherwise>
               <xsl:value-of select="choice[1]"/>
              </xsl:otherwise>
             </xsl:choose>
            </span>
           </tr>
           <!--选项二]-->
           <tr>
            <input type="radio" name="singal" value="no"/>
            <span>
             <xsl:attribute name="style"><xsl:if test="choice[2][@italic='true']">
          font-style:italic;
          </xsl:if><xsl:if test="choice[2][@bold='true']">
          font-weight:bold;
                          </xsl:if>
          font-size:<xsl:value-of select="choice[2]/@fontsize"/>pt;
          color:<xsl:value-of select="choice[2]/@color"/>;
          </xsl:attribute>
             <xsl:choose>
              <xsl:when test="choice[2][@underline='true']">
               <u>
                <xsl:value-of select="choice[2]"/>
               </u>
              </xsl:when>
              <xsl:otherwise>
               <xsl:value-of select="choice[2]"/>
              </xsl:otherwise>
             </xsl:choose>
            </span>
           </tr>
          </xsl:for-each>
          <!--多选问题-->
          <xsl:for-each select="multy_choice">
           <!--问题题目]-->
           <tr>
            <span>
             <xsl:attribute name="style"><xsl:if test="title[@italic='true']">
          font-style:italic;
          </xsl:if><xsl:if test="title[@bold='true']">
          font-weight:bold;
                          </xsl:if>
          font-size:<xsl:value-of select="title/@fontsize"/>pt;
          color:<xsl:value-of select="title/@color"/>;
          </xsl:attribute>
             <xsl:choose>
              <xsl:when test="title[@underline='true']">
               <u>
                <xsl:value-of select="@id"/>.<xsl:value-of select="title"/>
               </u>
              </xsl:when>
              <xsl:otherwise>
               <xsl:value-of select="@id"/>.<xsl:value-of select="title"/>
              </xsl:otherwise>
             </xsl:choose>
            </span>
           </tr>
           <!--问题选项]-->
           <!--选项一]-->
           <tr>
            <input type="checkbox" name="multi_1" value="1"/>
            <span>
             <xsl:attribute name="style"><xsl:if test="choice[1][@italic='true']">
          font-style:italic;
          </xsl:if><xsl:if test="choice[1][@bold='true']">
          font-weight:bold;
                          </xsl:if>
          font-size:<xsl:value-of select="choice[1]/@fontsize"/>pt;
          color:<xsl:value-of select="choice[1]/@color"/>;
          </xsl:attribute>
             <xsl:choose>
              <xsl:when test="choice[1][@underline='true']">
               <u>
                <xsl:value-of select="choice[1]"/>
               </u>
              </xsl:when>
              <xsl:otherwise>
               <xsl:value-of select="choice[1]"/>
              </xsl:otherwise>
             </xsl:choose>
            </span>
           </tr>
           <!--选项二]-->
           <tr>
            <input type="checkbox" name="multi_2" value="1"/>
            <span>
             <xsl:attribute name="style"><xsl:if test="choice[2][@italic='true']">
          font-style:italic;
          </xsl:if><xsl:if test="choice[2][@bold='true']">
          font-weight:bold;
                          </xsl:if>
          font-size:<xsl:value-of select="choice[2]/@fontsize"/>pt;
          color:<xsl:value-of select="choice[2]/@color"/>;
          </xsl:attribute>
             <xsl:choose>
              <xsl:when test="choice[2][@underline='true']">
               <u>
                <xsl:value-of select="choice[2]"/>
               </u>
              </xsl:when>
              <xsl:otherwise>
               <xsl:value-of select="choice[2]"/>
              </xsl:otherwise>
             </xsl:choose>
            </span>
           </tr>
           <!--选项三]-->
           <tr>
           <input type="checkbox" name="multi_3" value="1"/>
             <span>
             <xsl:attribute name="style"><xsl:if test="choice[3][@italic='true']">
          font-style:italic;
          </xsl:if><xsl:if test="choice[3][@bold='true']">
          font-weight:bold;
                          </xsl:if>
          font-size:<xsl:value-of select="choice[3]/@fontsize"/>pt;
          color:<xsl:value-of select="choice[3]/@color"/>;
          </xsl:attribute>
             <xsl:choose>
              <xsl:when test="choice[3][@underline='true']">
               <u>
                <xsl:value-of select="choice[3]"/>
               </u>
              </xsl:when>
              <xsl:otherwise>
               <xsl:value-of select="choice[3]"/>
              </xsl:otherwise>
             </xsl:choose>
            </span>
           </tr>
          </xsl:for-each>
          <!--简答题-->
          <xsl:for-each select="short_answer">
           <!--问题题目]-->
           <tr>
            <span>
             <xsl:attribute name="style"><xsl:if test="title[@italic='true']">
          font-style:italic;
          </xsl:if><xsl:if test="title[@bold='true']">
          font-weight:bold;
                          </xsl:if>
          font-size:<xsl:value-of select="title/@fontsize"/>pt;
          color:<xsl:value-of select="title/@color"/>;
          </xsl:attribute>
             <xsl:choose>
              <xsl:when test="title[@underline='true']">
               <u>
                <xsl:value-of select="@id"/>.<xsl:value-of select="title"/>
               </u>
              </xsl:when>
              <xsl:otherwise>
               <xsl:value-of select="@id"/>.<xsl:value-of select="title"/>
              </xsl:otherwise>
             </xsl:choose>
            </span>
           </tr>
           <tr>
            <textarea rows="5" cols="40" name="text"></textarea>
           </tr>
          </xsl:for-each>
          <tr>
           <td align="center">
            <input type="submit" name="submit" value="提交"/>
           </td>
          </tr>
         </table>
         </form>
        </xsl:for-each>
       </body>
      </html>
     </xsl:template>
    </xsl:stylesheet>

    ----------------------------------------------
    对工作,我投入;对爱情,我专一。

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2004/6/26 1:19:00
     
     yangjinhui 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:10
      积分:99
      门派:XML.ORG.CN
      注册:2004/6/21

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给yangjinhui发送一个短消息 把yangjinhui加入好友 查看yangjinhui的个人资料 搜索yangjinhui在『 XSL/XSLT/XSL-FO/CSS 』的所有贴子 引用回复这个贴子 回复这个贴子 查看yangjinhui的博客3
    发贴心情 
    问一下上面的东东,怎么才能让学习XML 能够入门。
    我是一个初学者
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2004/6/29 9:53: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/10 10:10:17

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

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