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