新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   >>中国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 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 42637 个阅读者浏览上一篇主题  刷新本主题   平板显示贴子 浏览下一篇主题
     * 贴子主题: [分享]发一个我写的通用xsl 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     hexun831012 帅哥哟,离线,有人找我吗?天秤座1983-10-12
      
      
      威望:1
      等级:研二(Pi-Calculus看得一头雾水)(版主)
      文章:800
      积分:5114
      门派:XML.ORG.CN
      注册:2006/12/8

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

    应admin要求,扩充并重发一遍
    <?xml version="1.0" encoding="utf-8"?>
    <?xml-stylesheet href="xml.xsl" type="text/xsl"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <!--Copyright(C) 2003-2006 Hexsoft, All Right Reserved.-->
     <xsl:template match="/">
      <html xmlns="http://www.w3.org/1999/xhtml">
       <head>
        <title>
         <xsl:value-of select="//comment()" />
        </title>
        <style type="text/css">
         .xml
         {
          font: normal normal normal 9pt Tahoma;
          color: blue;
         }
         .xml a
         {
          cursor: pointer;
         }
         .xml div
         {
          margin-left: 12px;
         }
         .xmlAttribute
         {
          color: red;
         }
          .xmlComment
         {
          color: green;
         }
          .xmlName
         {
          color: maroon;
         }
          .xmlPI
         {
          color: gray;
         }
          .xmlText
         {
          color: black;
         }
        </style>
        <script type="text/javascript">
         function collapseXml()
         {
          var a = event.srcElement;
          if(a.nodeName != "A")
          {
           a = a.parentNode;
          }
          var div = a.nextSibling;
          if(div.style.display == "")
          {
           div.style.display = "none";
          }
          else
          {
           div.style.display = "";
          }
         }
        </script>
       </head>
       <body class="xml">
        <span class="xmlPI">&lt;?xml version="1.0" encoding="utf-8"?&gt;</span>
        <br />
        <xsl:apply-templates />
       </body>
      </html>
     </xsl:template>
     <!--Processing Instruction Template-->
     <xsl:template match="processing-instruction()">
      <span class="xmlPI">
       <xsl:text>&lt;?</xsl:text>
       <xsl:value-of select="name()" />
       <xsl:text> </xsl:text>
       <xsl:value-of select="." />
       <xsl:text>?&gt;</xsl:text>
      </span>
      <br />
     </xsl:template>
     <!--Comment Template-->
     <xsl:template match="comment()">
      <span class="xmlComment">
       <xsl:text>&lt;!--</xsl:text>
       <xsl:value-of select="." />
       <xsl:text>--&gt;</xsl:text>
      </span>
      <br />
     </xsl:template>
     <!--Attribute Template-->
     <xsl:template match="@*">
      <xsl:text> </xsl:text>
      <span class="xmlAttribute">
       <xsl:value-of select="name()" />
      </span>
      <xsl:text>="</xsl:text>
      <span class="xmlText">
       <xsl:value-of select="." />
      </span>
      <xsl:text>"</xsl:text>
     </xsl:template>
     <!--Text Template-->
     <xsl:template match="text()">
      <span class="xmlText">
       <xsl:value-of select="." />
      </span>
      <br />
     </xsl:template>
     <!--Empty Element Template-->
     <xsl:template match="*">
      <xsl:text>&lt;</xsl:text>
      <span class="xmlName">
       <xsl:value-of select="name()" />
      </span>
      <xsl:apply-templates select="@*" />
      <xsl:text> /&gt;</xsl:text>
      <br />
     </xsl:template>
     <!--Text Element Template-->
     <xsl:template match="*[text()]">
      <xsl:text>&lt;</xsl:text>
      <span class="xmlName">
       <xsl:value-of select="name()" />
      </span>
      <xsl:apply-templates select="@*" />
      <xsl:text>&gt;</xsl:text>
      <span class="xmlText">
       <xsl:value-of select="text()" />
      </span>
      <xsl:text>&lt;/</xsl:text>
      <span class="xmlName">
       <xsl:value-of select="name()" />
      </span>
      <xsl:text>&gt;</xsl:text>
      <br />
     </xsl:template>
     <!--Parent Element Template-->
     <xsl:template match="*[*]">
      <a onclick="collapseXml()">
       <xsl:text>&lt;</xsl:text>
       <span class="xmlName">
        <xsl:value-of select="name()" />
       </span>
       <xsl:apply-templates select="@*" />
       <xsl:text>&gt;</xsl:text>
      </a>
      <div>
       <xsl:apply-templates />
      </div>
      <xsl:text>&lt;/</xsl:text>
      <span class="xmlName">
       <xsl:value-of select="name()" />
      </span>
      <xsl:text>&gt;</xsl:text>
      <br />
     </xsl:template>
    </xsl:stylesheet>
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2006/12/14 12:19:00
     
     GoogleAdSense天秤座1983-10-12
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 XSL/XSLT/XSL-FO/CSS 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/4/28 3:48:02

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

     *树形目录 (最近20个回帖) 顶端 
    主题:  [分享]发一个我写的通用xsl(3337字) - hexun831012,2006年12月12日
        回复:  谢谢!(6字) - 无忧的大脑门,2008年3月17日
        回复:  问一下, 为什么叫通用 xsl通用在哪里了?(39字) - redskywy,2007年9月6日
        回复:  这个是否就是显示全部结点的通用xsl呢?(37字) - fifastar,2007年9月5日
        回复:  你放了不少血了。。(20字) - KELLY5677,2007年7月30日
        回复:  我的通用XSL是针对浏览器的,在IE和MF的解析器下都是完全一样的效果,他们都是完全符合W3C的标..(92字) - hexun831012,2007年7月19日
        回复:  前些天也用js+MSXML 方式遍历DOM节点,仿IE浏览XML方式输出。改天整理贴上来。..(73字) - Qr,2007年7月18日
        回复:  好牛的xsl!(11字) - zhu_ruixian,2007年7月16日
        回复:  再顶。。。(10字) - insky,2007年7月12日
        回复:  顶。(4字) - 火鸟,2007年7月7日
        回复:  重发通用XSL,支持firefox啦!!!<?xml version="1.0" encodin..(3471字) - hexun831012,2007年4月25日
        回复:  用高级语言解析xml需要用到循环递归,就以根节点为入口,循环解析每个节点所有可能的自节点的算法,代..(169字) - hexun831012,2007年3月6日
        回复:  发现一点问题,重新修订过了<?xml version="1.0" encoding="utf-8..(3334字) - hexun831012,2007年3月5日
            回复:  各位高手,我想知道一些关于xml在vxworks下用c语言解析的方法,或是原代码也好.请个位高手..(100字) - alittlecat,2007年3月5日
        回复:  应admin要求,扩充并重发一遍<?xml version="1.0" encoding="ut..(3739字) - hexun831012,2006年12月14日
        回复:  申请精华申请至顶(18字) - hexun831012,2006年12月12日
            回复:  hexun831012你的通用xslt在MSXML下面也许是对的,可在Saxon下面通不过检查,有..(85字) - 火鸟,2007年7月19日

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