⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shopping.xslt

📁 基于java的xsl与xml程序例子
💻 XSLT
字号:
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <!--
  *********************************************************************
  ** global.sessionID : Used for URL-rewriting to implement 
  **                    session tracking without cookies.
  ******************************************************************-->
  <xsl:param name="global.sessionID"/>
  
  <!-- This stylesheet produces XHTML -->
  <xsl:output method="xml" indent="yes" encoding="UTF-8"
  doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
  doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>

  <!-- 
  *********************************************************************
  ** This template produces the skeletal XHTML document.
  ******************************************************************-->
  <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <title>Shopping Example</title>
      </head>
      <body>
        <!-- Create a form for this page -->
        <form method="post">
          <!-- Specify the form action="..." attribute -->
          <xsl:attribute name="action">
            <!-- Encode the session identifier into the URL 
                 to enable session tracking. -->
            <xsl:call-template name="encodeURL">
              <xsl:with-param name="url" select="'/chap8/shopping'"/>
            </xsl:call-template>
          </xsl:attribute>

          <h1>Shopping Example</h1>
          ...remainder of page omitted
        </form>
      </body>
    </html>
  </xsl:template>

  <!-- 
  *********************************************************************
  ** This template performs URL rewriting if the $global.sessionID
  ** variable has been set. The caller must pass in a 'url' parameter.
  ******************************************************************-->
  <xsl:template name="encodeURL">
    <xsl:param name="url"/>

    <!-- output the url. -->
    <xsl:value-of select="$url"/>

    <!-- If $global.sessionID is set, also
         output ";jsessionid=0000000"  -->
    <xsl:if test="$global.sessionID">
      <xsl:text>;jsessionid=</xsl:text>
      <xsl:value-of select="$global.sessionID"/>
    </xsl:if>
  </xsl:template>
  
</xsl:stylesheet>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -