paulb@473 | 1 | <?xml version="1.0"?> |
paulb@473 | 2 | <!-- |
paulb@473 | 3 | Copyright (C) 2006 Paul Boddie <paul@boddie.org.uk> |
paulb@473 | 4 | |
paulb@473 | 5 | This library is free software; you can redistribute it and/or |
paulb@473 | 6 | modify it under the terms of the GNU Lesser General Public |
paulb@473 | 7 | License as published by the Free Software Foundation; either |
paulb@473 | 8 | version 2.1 of the License, or (at your option) any later version. |
paulb@473 | 9 | |
paulb@473 | 10 | This library is distributed in the hope that it will be useful, |
paulb@473 | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
paulb@473 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
paulb@473 | 13 | Lesser General Public License for more details. |
paulb@473 | 14 | |
paulb@473 | 15 | You should have received a copy of the GNU Lesser General Public |
paulb@473 | 16 | License along with this library; if not, write to the Free Software |
paulb@473 | 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
paulb@473 | 18 | --> |
paulb@473 | 19 | <xsl:stylesheet version="1.0" |
paulb@473 | 20 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
paulb@475 | 21 | xmlns:template="http://www.boddie.org.uk/ns/xmltools/template" |
paulb@475 | 22 | xmlns:str="http://exslt.org/strings" |
paulb@475 | 23 | extension-element-prefixes="str"> |
paulb@473 | 24 | |
paulb@475 | 25 | <!-- NOTE: Add various top-level definitions specific to XHTML. --> |
paulb@475 | 26 | |
paulb@475 | 27 | <xsl:output indent="yes" |
paulb@475 | 28 | doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" |
paulb@475 | 29 | doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/> |
paulb@473 | 30 | |
paulb@473 | 31 | |
paulb@473 | 32 | |
paulb@473 | 33 | <!-- Remove the mangled template namespace declaration. --> |
paulb@473 | 34 | |
paulb@473 | 35 | <xsl:template match="@template"> |
paulb@473 | 36 | </xsl:template> |
paulb@473 | 37 | |
paulb@473 | 38 | |
paulb@473 | 39 | |
paulb@473 | 40 | <!-- Match specific template attributes. --> |
paulb@473 | 41 | |
paulb@475 | 42 | <xsl:template match="@if|@element|@attribute|@attribute-field|@attribute-area|@attribute-button|@attribute-list-button|@selector-field|@multiple-choice-field|@multiple-choice-list-field|@multiple-choice-value|@multiple-choice-list-value|@multiple-choice-list-element|@effect|@value|@expr|@expr-attr|@i18n"> |
paulb@473 | 43 | <!-- Add the namespace. --> |
paulb@473 | 44 | <xsl:attribute name="template:{local-name(.)}"> |
paulb@473 | 45 | <xsl:copy-of select="string(.)"/> |
paulb@473 | 46 | </xsl:attribute> |
paulb@473 | 47 | </xsl:template> |
paulb@473 | 48 | |
paulb@473 | 49 | |
paulb@473 | 50 | |
paulb@475 | 51 | <!-- Fix strings in attributes. --> |
paulb@475 | 52 | |
paulb@475 | 53 | <xsl:template name="fix-string"> |
paulb@475 | 54 | <xsl:copy-of select="str:decode-uri(string(.))"/> |
paulb@475 | 55 | </xsl:template> |
paulb@475 | 56 | |
paulb@475 | 57 | |
paulb@475 | 58 | |
paulb@475 | 59 | <!-- Handle special attributes. --> |
paulb@475 | 60 | |
paulb@475 | 61 | <xsl:template match="@href|@src"> |
paulb@475 | 62 | <xsl:attribute name="{name(.)}"> |
paulb@475 | 63 | <xsl:call-template name="fix-string"/> |
paulb@475 | 64 | </xsl:attribute> |
paulb@475 | 65 | </xsl:template> |
paulb@475 | 66 | |
paulb@475 | 67 | |
paulb@475 | 68 | |
paulb@473 | 69 | <!-- Traverse unknown nodes. --> |
paulb@473 | 70 | |
paulb@473 | 71 | <xsl:template match="@*|node()"> |
paulb@473 | 72 | <xsl:copy> |
paulb@473 | 73 | <xsl:apply-templates select="@*|node()"/> |
paulb@473 | 74 | </xsl:copy> |
paulb@473 | 75 | </xsl:template> |
paulb@473 | 76 | |
paulb@473 | 77 | </xsl:stylesheet> |