2007-12-23 22:04:25 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 09:23:09 +00:00
|
|
|
<!-- $Revision$ -->
|
2007-12-23 22:04:25 +00:00
|
|
|
|
|
|
|
<chapter xml:id="xsl.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
|
|
&reftitle.examples;
|
|
|
|
<section xml:id="xsl.examples-collection">
|
|
|
|
<para>
|
|
|
|
Many examples in this reference require both an XML and an XSL file.
|
|
|
|
We will use <filename>collection.xml</filename> and
|
|
|
|
<filename>collection.xsl</filename> that contains the following:
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title>collection.xml</title>
|
|
|
|
<programlisting role="xml">
|
|
|
|
<![CDATA[
|
|
|
|
<collection>
|
|
|
|
<cd>
|
|
|
|
<title>Fight for your mind</title>
|
|
|
|
<artist>Ben Harper</artist>
|
|
|
|
<year>1995</year>
|
|
|
|
</cd>
|
|
|
|
<cd>
|
|
|
|
<title>Electric Ladyland</title>
|
|
|
|
<artist>Jimi Hendrix</artist>
|
|
|
|
<year>1997</year>
|
|
|
|
</cd>
|
|
|
|
</collection>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
<example>
|
|
|
|
<title>collection.xsl</title>
|
|
|
|
<programlisting role="xml">
|
|
|
|
<![CDATA[
|
|
|
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
|
|
<xsl:param name="owner" select="'Nicolas Eliaszewicz'"/>
|
|
|
|
<xsl:output method="html" encoding="iso-8859-1" indent="no"/>
|
|
|
|
<xsl:template match="collection">
|
|
|
|
Hey! Welcome to <xsl:value-of select="$owner"/>'s sweet CD collection!
|
|
|
|
<xsl:apply-templates/>
|
|
|
|
</xsl:template>
|
|
|
|
<xsl:template match="cd">
|
|
|
|
<h1><xsl:value-of select="title"/></h1>
|
|
|
|
<h2>by <xsl:value-of select="artist"/> - <xsl:value-of select="year"/></h2>
|
|
|
|
<hr />
|
|
|
|
</xsl:template>
|
|
|
|
</xsl:stylesheet>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
</chapter>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:t
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
indent-tabs-mode:nil
|
|
|
|
sgml-parent-document:nil
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2007-12-23 22:04:25 +00:00
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
|
|
vim: et tw=78 syn=sgml
|
|
|
|
vi: ts=1 sw=1
|
|
|
|
-->
|
|
|
|
|