xsl.examples.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 72 行

HTML
72
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Examples</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="xsl.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.xsltprocessor.html">XSLTProcessor</a></div> <div class="up"><a href="book.xsl.html">XSL</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div> <h1>Examples</h1> <div id="xsl.examples-collection" class="section">  <p class="para">   Many examples in this reference require both an XML and an XSL file.   We will use <var class="filename">collection.xml</var> and    <var class="filename">collection.xsl</var> that contains the following:  </p>  <p class="para">   <div class="example">    <p><b>Example #1 collection.xml</b></p>    <div class="example-contents"><div class="cdata"><pre>&lt;collection&gt; &lt;cd&gt;  &lt;title&gt;Fight for your mind&lt;/title&gt;  &lt;artist&gt;Ben Harper&lt;/artist&gt;  &lt;year&gt;1995&lt;/year&gt; &lt;/cd&gt; &lt;cd&gt;  &lt;title&gt;Electric Ladyland&lt;/title&gt;  &lt;artist&gt;Jimi Hendrix&lt;/artist&gt;  &lt;year&gt;1997&lt;/year&gt; &lt;/cd&gt;&lt;/collection&gt;</pre></div>    </div>   </div>   <div class="example">    <p><b>Example #2 collection.xsl</b></p>    <div class="example-contents"><div class="cdata"><pre>&lt;xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt; &lt;xsl:param name=&quot;owner&quot; select=&quot;&#039;Nicolas Eliaszewicz&#039;&quot;/&gt; &lt;xsl:output method=&quot;html&quot; encoding=&quot;iso-8859-1&quot; indent=&quot;no&quot;/&gt; &lt;xsl:template match=&quot;collection&quot;&gt;  Hey! Welcome to &lt;xsl:value-of select=&quot;$owner&quot;/&gt;&#039;s sweet CD collection!   &lt;xsl:apply-templates/&gt; &lt;/xsl:template&gt; &lt;xsl:template match=&quot;cd&quot;&gt;  &lt;h1&gt;&lt;xsl:value-of select=&quot;title&quot;/&gt;&lt;/h1&gt;  &lt;h2&gt;by &lt;xsl:value-of select=&quot;artist&quot;/&gt; - &lt;xsl:value-of select=&quot;year&quot;/&gt;&lt;/h2&gt;  &lt;hr /&gt; &lt;/xsl:template&gt;&lt;/xsl:stylesheet&gt;</pre></div>    </div>   </div>  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="xsl.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.xsltprocessor.html">XSLTProcessor</a></div> <div class="up"><a href="book.xsl.html">XSL</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

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