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

    >> 本版讨论XSL,XSLT,XSL-FO,CSS等技术
    [返回] 计算机科学论坛XML.ORG.CN讨论区 - XML技术『 XSL/XSLT/XSL-FO/CSS 』 → 在xsl中怎样使用javascript来验证必添项 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 2484 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: 在xsl中怎样使用javascript来验证必添项 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     linyang0106 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:0
      积分:52
      门派:XML.ORG.CN
      注册:2005/4/20

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

    我的xml中有<input type="text" value=" 默认值" need="*"/>
    然后我用xsl解析成一个输入框
    那么我怎样在xsl写js脚本,让这个输入框提交时做必添项的检验呢?

    我的完整xml
    <?xml version="1.0" encoding="gb2312"?>
    <configRoot>
     <item>
      <itemIndicate value="关键词"  alt="关键词" need="*">
      <input type="text" value=" 默认值" />
      </itemIndicate>
     </item>
     <item>
      <itemIndicate value="网址" need="*">
      <input type="text" value=" 默认值"/>
      </itemIndicate>
     </item>
     <item>
      <itemIndicate value="申请目的和用途" need="*">
      <input type="text" value=" 默认值"/>
      </itemIndicate>
     </item>
     <item>
      <itemIndicate value="申请目的和用途" >
      <input type="TextArea" value=" 默认值" need="*"/>
      </itemIndicate>
     </item>
     <item>
      <itemIndicate value="申请目的和用途">
      <input type="select"  value=" 默认值">
        <option>aaa</option>
        <option>bbb</option>
      </input>
      </itemIndicate>
     </item>
     <item>
      <itemIndicate value="申请单位">
      <input type="label"  value=" 默认值" />
          </itemIndicate>
     </item>

     <item>
      <itemIndicate value="中文名称(中文)">
      <input type="text"  value=" 默认值" need="*"/>
      </itemIndicate>
      <itemIndicate value="联系人(中文)">
      <input type="text" value=" 默认值"/>
      </itemIndicate>
     </item>
     <item>
      <itemIndicate value="中文名称(英文)">
      <input type="text"  value=" 默认值"/>
      </itemIndicate>
      <itemIndicate value="联系人(中文)">
      <input type="text"  value=" 默认值"/>
      </itemIndicate>
     </item>
     <item>
      <itemIndicate>
      <input type="submit"  value="提交"/>
      </itemIndicate>
      <itemIndicate>
      <input type="cancel"  value="取消"/>
      </itemIndicate>
     </item>
    </configRoot>

    我的完整xsl
    <?xml version="1.0" encoding="gb2312"?>
    <xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/configRoot">
    <html>
      <head>
    <script language="javascript">

    function subm()
      {

      }
      </script>
      </head>
      <body>
      <form  onsubmit="return subm()">
      <table>
    <xsl:apply-templates select="item"/>

    </table>
      </form>
      </body>
    </html>
    </xsl:template>

    <xsl:template name="item" match="item">

          <tr>
    <xsl:for-each select="itemIndicate">
    <xsl:apply-templates  select="."/>
    </xsl:for-each>
         </tr>

    </xsl:template>

    <xsl:template name="itemIndicate" match="itemIndicate">
    <td title="{@value}" >
    <xsl:value-of select="@value"/>

    </td>
    <xsl:for-each select="input">
      <td>
      <xsl:apply-templates  select="."/>
      </td>
    </xsl:for-each>

    </xsl:template>

    <xsl:template match="input">

         <xsl:if test="@type ='text'">

         

        <input name=""  type="text"  value="aaa"  height="15"  width="15"/>


          </xsl:if>


         <xsl:if test="@type ='TextArea'">

        <textarea name="" cols="" rows=""><xsl:value-of select="."/></textarea>
         </xsl:if>
         
         <xsl:if test="@type ='select'">

       <select name="">
        <xsl:for-each select="option">     
    <option>
    <xsl:value-of select="."/>
    </option>
        </xsl:for-each>

       </select>
         </xsl:if>

         <xsl:if test="@type ='label'">

        <label><xsl:value-of select="."/></label>
         </xsl:if>
         <xsl:if test="@type ='submit'">
         <input type="submit" value="{@value}"/>
         </xsl:if>
         <xsl:if test="@type ='cancel'">
         <input type="reset" value="{@value}"/>
         </xsl:if>
         <xsl:if test="@need ='*'">
          
           *
         
         </xsl:if>
    </xsl:template>

    </xsl:stylesheet>


       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/4/20 7:58: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/12/24 1:05:50

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

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