posts - 2,  comments - 0,  trackbacks - 0

          xsl :

          xsl inclulde xslt,xpath,xsl-FO

          xslt is used transform the xml to the document understood by IE such as html.

          Given these design goals, what are XSLT's strengths? Here are some scenarios:

        1. Your web site needs to deliver information to a variety of devices. You need to support ordinary desktop browsers, as well as pagers, mobile phones, and other low-resolution, low-function devices. It would be great if you could create your information in structured documents, then transform those documents into all the formats you need.

        2. You need to exchange data with your partners, but all of you use different database systems. It would be great if you could define a common XML data format, then transform documents written in that format into the import files you need (SQL statements, comma-separated values, etc.).

        3. To stay on the cutting edge, your web site gets a complete visual redesign every few months. Even though things such as server-side includes and CSS can help, they can't do everything. It would be great if your data were in a flexible format that could be transformed into any look and feel, simplifying the redesign process.

        4. You have documents in several different formats. All the documents are machine-readable, but it's a hassle to write programs to parse and process all of them. It would be great if you could combine all of the documents into a single format, then generate summary documents and reports based on that collection of documents. It would be even better if the report could contain calculated values, automatically generated graphics, and formatting for high-quality printing.


          eg.

          
              <?xml version="1.0"?>
              <CATALOG>
                <CD>
                  <TITLE>Empire Burlesque</TITLE>
                  <ARTIST>Bob Dylan</ARTIST>
                  <COUNTRY>USA</COUNTRY>
                  <COMPANY>Columbia</COMPANY>
                  <PRICE>10.90</PRICE>
                  <YEAR>1985</YEAR>
                </CD>
              .
              .
              .
              還有附帶的XSL樣式表:
              <?xml version='1.0'?>
              <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
              <xsl:template match="/">
                <html>
                <body>
                  <table border="2" bgcolor="yellow">
                    <tr>
                      <th>Title</th>
                      <th>Artist</th>
                    </tr>
                    <xsl:for-each select="CATALOG/CD">
                    <tr>
                      <td><xsl:value-of select="TITLE"/></td>
                      <td><xsl:value-of select="ARTIST"/></td>
                    </tr>
                    </xsl:for-each>
                  </table>
                </body>
                </html>
              </xsl:template>
              </xsl:stylesheet>
          

          We can use javascript to implement in client:


        5. 
              <html>
              <body>
              <script language="javascript">
              // Load XML
              var xml = new ActiveXObject("Microsoft.XMLDOM")
              xml.async = false
              xml.load("cd_catalog.xml")
              // Load the XSL
              var xsl = new ActiveXObject("Microsoft.XMLDOM")
              xsl.async = false
              xsl.load("cd_catalog.xsl")
              // Transform
              document.write(xml.transformNode(xsl))
              </script>
              </body>
              </html>
          


          In server :
          
              <%
              'Load the XML
              set xml = Server.CreateObject("Microsoft.XMLDOM")
              xml.async = false
              xml.load(Server.MapPath("cd_catalog.xml"))
              'Load the XSL
              set xsl = Server.CreateObject("Microsoft.XMLDOM")
              xsl.async = false
              xsl.load(Server.MapPath("cd_catalog.xsl"))
              'Transform the file
              Response.Write(xml.transformNode(xsl))
              %>
          

          posted on 2006-02-13 11:54 Felix 閱讀(97) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          <2025年7月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          常用鏈接

          留言簿(2)

          隨筆檔案

          文章檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 津南区| 甘洛县| 昭觉县| 和顺县| 宜宾市| 张掖市| 虎林市| 紫金县| 安阳市| 龙门县| 东平县| 荆州市| 缙云县| 当涂县| 友谊县| 汽车| 乌苏市| 张掖市| 沈丘县| 阜城县| 儋州市| 牙克石市| 会东县| 宝应县| 炉霍县| 深泽县| 湖南省| 涡阳县| 开平市| 镇远县| 泽州县| 贵溪市| 保康县| 南漳县| 老河口市| 宜兰县| 康保县| 青龙| 轮台县| 桑日县| 册亨县|