1 <?xml version='1.0' encoding='utf-8'?>
3 <!-- XHTML-to-XHTML converter by Fletcher Penney
4 specifically designed for use with MultiMarkdown created XHTML
6 Looks for code blocks that start with `[poetry]`. If matched,
7 strip the poetry tag, apply the poetry class to the <pre> element,
8 and strip out the <code> wrapper.
10 Another example of what can be done with a post-processing XSLT.
12 MultiMarkdown Version 2.0.b5
14 $Id: xhtml-poetry-support.xslt 479 2008-01-12 23:04:13Z fletcher $
18 # Copyright (C) 2007-2008 Fletcher T. Penney <fletcher@fletcherpenney.net>
20 # This program is free software; you can redistribute it and/or modify
21 # it under the terms of the GNU General Public License as published by
22 # the Free Software Foundation; either version 2 of the License, or
23 # (at your option) any later version.
25 # This program is distributed in the hope that it will be useful,
26 # but WITHOUT ANY WARRANTY; without even the implied warranty of
27 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 # GNU General Public License for more details.
30 # You should have received a copy of the GNU General Public License
31 # along with this program; if not, write to the
32 # Free Software Foundation, Inc.
33 # 59 Temple Place, Suite 330
34 # Boston, MA 02111-1307 USA
39 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
40 xmlns:xhtml="http://www.w3.org/1999/xhtml"
41 xmlns="http://www.w3.org/1999/xhtml"
42 exclude-result-prefixes="xhtml xsl"
45 <xsl:variable name="newline">
50 <xsl:output method='xml' version="1.0" encoding='utf-8' doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" doctype-system="http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" indent="no"/>
52 <!-- the identity template, based on http://www.xmlplease.com/xhtmlxhtml -->
53 <xsl:template match="@*|node()">
55 <xsl:apply-templates select="@*|node()"/>
59 <xsl:template match="xhtml:pre">
61 <xsl:when test="starts-with(child::xhtml:code,'[poetry]')">
63 <xsl:apply-templates select="@*|node()" mode="poetry"/>
68 <xsl:apply-templates select="@*|node()"/>
74 <xsl:template match="xhtml:code" mode="poetry">
75 <xsl:value-of select="substring-after(.,'[poetry]')"/>