test_stylesheet2.jsp

来自「jakarta-taglibs」· JSP 代码 · 共 101 行

JSP
101
字号
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<%@ taglib uri="http://jakarta.apache.org/taglibs/xtags-1.0"
prefix="xtags" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>Test &lt;xtags:stylesheet&gt;</title>
<link rel="stylesheet" href="../examples.css" type="text/css">
</head>

<body>

<h1>Test &lt;xtags:stylesheet&gt;</h1>


<xtags:parse>

  <simpleDocument author="James Elson">

    <title>Bwahahahah!</title>

    <synopsis>Twas a dark, rainy night...</synopsis>

    <para>dfjsdfjsdf</para>
    <para>fdsfsdfhdsff gyuf uysgf ds</para>

  </simpleDocument>

</xtags:parse>

<xtags:stylesheet>

  <xtags:template match="/">
    <xtags:applyTemplates/>
  </xtags:template>

  <xtags:template match="title">
    <h2><xtags:applyTemplates/></h2>
  </xtags:template>


  <xtags:template match="para">
    <p><xtags:applyTemplates/></p>
  </xtags:template>

  <xtags:template match="*">
    <small><xtags:applyTemplates/></small>
  </xtags:template>

</xtags:stylesheet>

<hr>

<xtags:stylesheet>

  <xtags:template match="/">
    <xtags:applyTemplates/>
  </xtags:template>

  <xtags:template match="*">
    <small><xtags:applyTemplates/></small>
  </xtags:template>

  <xtags:template match="title">
    <h2><xtags:applyTemplates/></h2>
  </xtags:template>


  <xtags:template match="para">
    <p><xtags:applyTemplates/></p>
  </xtags:template>

</xtags:stylesheet>

<hr>


<xtags:stylesheet>

  <xtags:template match="/simpleDocument">
   <h2>Book review</h2>
   <b>Title:</b> <xtags:applyTemplates select="title"/><br />
   <b>Author:</b> <xtags:applyTemplates select="@author"/><br />
   <b>Summary:</b> <em><xtags:applyTemplates select="synopsis"/></em><br />
  </xtags:template>

  <xtags:template match="title">
    <span style="color:blue"><xtags:applyTemplates/></span>
  </xtags:template>


  <xtags:template match="para">
    <p><xtags:applyTemplates/></p>
  </xtags:template>

</xtags:stylesheet>


</body>
</html>

⌨️ 快捷键说明

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