Apache-XBEL
view release on metacpan or search on metacpan
xsl/apache-xbel.xsl view on Meta::CPAN
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
xmlns:asc="urn:aaronstraupcope:apache:xbel"
xmlns:doc="http://xsltsl.org/xsl/documentation/1.0"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:x="http://pyxml.sourceforge.net/topics/xbel/"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes = "asc doc h x"
version="1.0">
<!-- ======================================================================
====================================================================== -->
<doc:reference>
<referenceinfo>
<title>apache-xbel.xsl</title>
<abstract>
<para>This is an <acronym>XSLT</acronym> stylesheet for
transforming XBEL 1.0 documents in XHTML 1.1 documents</para>
</abstract>
<author>
<surname>Cope</surname>
<firstname>Aaron</firstname>
<othername>Straup</othername>
</author>
<legalnotice>
<para>This is based on work originally developed by Joris
Graaumans http://www.cs.ruu.nl/~joris/stuff.html</para>
<para>This work is licensed under the Creative Commons
Attribution-ShareAlike License. To view a copy of this
license, visit http://creativecommons.org/licenses/by-sa/1.0/
or send a letter to Creative Commons, 559 Nathan Abbott Way,
Stanford, California 94305, USA.</para>
</legalnotice>
<revhistory>
<revision>
<revnumber>1.2</revnumber>
<date>March 01, 2004</date>
<revremark>
<para>Replaced numeric IDs for folders with XBEL folder/@id
and added hooks to toggle display for root element when
displaying a slice.</para>
</revremark>
</revision>
</revhistory>
</referenceinfo>
<partintro>
<section>
<title>Usage</title>
<para>Consult the documentation for your favourite
<acronym>XSLT</acronym> processor.</para>
<para>This stylesheet accepts two parameters, both of which are
optional:</para>
<itemizedlist>
<listitem>
<formalpara>
<title>base</title>
<para>String. If defined, this value will be used to set the
value of '/html/head/base'.</para>
</formalpara>
</listitem>
<listitem>
<formalpara>
<title>lang</title>
<para>String. If defined, this value will be used to set the
value of '/html[@xml:lang]'.</para>
</formalpara>
</listitem>
<listitem>
<formalpara>
<title>disable-output-escaping</title>
<para>Boolean. If defined, output-escaping will be disabled
for title and description nodes.</para>
</formalpara>
</listitem>
</itemizedlist>
<para>If your XSLT processors supports custom functions and the
following functions have been registered, this stylesheet will
create a 'breadcrumb' style navigation list in the XHTML output.</para>
<itemizedlist>
<listitem>
<formalpara>
<title>asc:breadcrumbs</title>
<para>Each time this function is called, it will return the
next value in the list of breadcrumbs for the current
path.</para>
</formalpara>
</listitem>
<listitem>
<formalpara>
<title>asc:href_from_crumb</title>
<para>Each time this function is called, it will return a
URL for the last value returned by the 'asc:breadcrumbs'
function.</para>
</formalpara>
</listitem>
</itemizedlist>
<para>The namespace for these functions is : 'urn:aaronstraupcope:apache:xbel'</para>
</section>
</partintro>
</doc:reference>
<!-- ======================================================================
====================================================================== -->
<!-- this is considered a bug until I can either
a) figure out the correct magic to prevent
JavaScript operators from being escaped.
b) move the JavaScript into a separate file
altogether -->
<xsl:output method = "html" />
<xsl:output indent = "yes" />
<xsl:output doctype-public = "-//W3C//DTD XHTML 1.1//EN" />
<xsl:output doctype-system = "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" />
<!-- ======================================================================
====================================================================== -->
<xsl:param name = "disable-output-escaping" />
<xsl:param name = "base" />
<xsl:param name = "lang" />
<!-- ======================================================================
====================================================================== -->
<xsl:template match="/">
<html>
<xsl:if test = "$lang">
<xsl:attribute name = "xml:lang">
<xsl:value-of select = "$lang" />
</xsl:attribute>
</xsl:if>
<xsl:call-template name = "Head" />
<xsl:call-template name = "Body" />
</html>
</xsl:template>
<!-- ======================================================================
====================================================================== -->
<xsl:template name = "Head">
<head>
<title>
<xsl:value-of select = "/xbel/title" />
</title>
<meta>
<xsl:attribute name = "name">author</xsl:attribute>
<xsl:attribute name = "content">
<xsl:value-of select = "/xbel/info/metadata/@owner" />
</xsl:attribute>
</meta>
<meta>
<xsl:attribute name = "name">description</xsl:attribute>
<xsl:attribute name = "content">
<xsl:value-of select = "/xbel/desc" />
</xsl:attribute>
</meta>
<xsl:if test = "$base">
<base>
<xsl:attribute name = "href">
<xsl:value-of select = "$base" />
</xsl:attribute>
</base>
</xsl:if>
( run in 2.923 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )