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)  編輯  收藏

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


          網(wǎng)站導(dǎo)航:
           
          <2025年7月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          常用鏈接

          留言簿(2)

          隨筆檔案

          文章檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 汤阴县| 吉安市| 弥渡县| 祁门县| 青铜峡市| 谢通门县| 扎兰屯市| 平武县| 永泰县| 沭阳县| 荆门市| 金阳县| 清河县| 襄垣县| 新巴尔虎右旗| 瑞丽市| 建水县| 大悟县| 建阳市| 西乌珠穆沁旗| 罗田县| 武穴市| 五台县| 水富县| 连城县| 台东市| 陇川县| 岱山县| 正宁县| 利川市| 巴马| 天台县| 浠水县| 西吉县| 宜阳县| 连平县| 白水县| 黑水县| 云龙县| 荥经县| 遵义市|