Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 12745

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Example collection.xml and collection.xsl files</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="xsl.examples.html">Examples</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="class.xsltprocessor.html">XSLTProcessor</a></div>
 <div class="up"><a href="xsl.examples.html">Examples</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="xsl.examples-collection" class="section">
  <h2 class="title">Example collection.xml and collection.xsl files</h2>
  <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" id="example-5536">
    <p><strong>Example #1 collection.xml</strong></p>
    <div class="example-contents">
<div class="xmlcode"><pre class="xmlcode">&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" id="example-5537">
    <p><strong>Example #2 collection.xsl</strong></p>
    <div class="example-contents">
<div class="xmlcode"><pre class="xmlcode">&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><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="xsl.examples.html">Examples</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="class.xsltprocessor.html">XSLTProcessor</a></div>
 <div class="up"><a href="xsl.examples.html">Examples</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>