Mercurial > hg > mpdl-group
diff software/mpdl-services-new/mpiwg-mpdl-cms/src/de/mpg/mpiwg/berlin/mpdl/cms/transform/tocOut.xsl @ 25:e9fe3186670c default tip
letzter Stand eingecheckt
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 21 May 2013 10:19:32 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/software/mpdl-services-new/mpiwg-mpdl-cms/src/de/mpg/mpiwg/berlin/mpdl/cms/transform/tocOut.xsl Tue May 21 10:19:32 2013 +0200 @@ -0,0 +1,45 @@ +<?xml version="1.0"?> + +<xsl:stylesheet + version="2.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +> + +<xsl:output method="xhtml"/> + +<xsl:param name="type"></xsl:param> +<xsl:param name="outputFormat"></xsl:param> + +<xsl:template match="/"> + <xsl:choose> + <xsl:when test="$outputFormat = 'html'"> + <xsl:apply-templates select="//*:list[@type = $type]/item" mode="html"/> + </xsl:when> + <xsl:otherwise> + <xsl:sequence select="//*:list[@type = $type]"/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template match="*:item" mode="html"> + <xsl:variable name="n" select="@n"/> + <xsl:variable name="level" select="@lv"/> + <div> + <xsl:attribute name="class"><xsl:value-of select="'tocItem'"/></xsl:attribute> + <xsl:value-of select="concat($n, ' ')"/> + <xsl:apply-templates mode="html"/> + </div> +</xsl:template> + +<xsl:template match="*:ref" mode="html"> + <xsl:variable name="pageOrig" select="@o"/> + <xsl:variable name="page" select="text()"/> + <xsl:variable name="pageHref" select="concat('#page', $page)"/> + <span> + <xsl:attribute name="class"><xsl:value-of select="'tocPageRef'"/></xsl:attribute> + <xsl:value-of select="'Page: '"/> + <a href="{$pageHref}"><xsl:apply-templates mode="html"/></a> + </span> +</xsl:template> + +</xsl:stylesheet>