paulb@50 | 1 | <?xml version="1.0"?> |
paulb@274 | 2 | <!-- |
paulb@274 | 3 | Copyright (C) 2005 Paul Boddie <paul@boddie.org.uk> |
paulb@274 | 4 | |
paulb@274 | 5 | This library is free software; you can redistribute it and/or |
paulb@274 | 6 | modify it under the terms of the GNU Lesser General Public |
paulb@274 | 7 | License as published by the Free Software Foundation; either |
paulb@274 | 8 | version 2.1 of the License, or (at your option) any later version. |
paulb@274 | 9 | |
paulb@274 | 10 | This library is distributed in the hope that it will be useful, |
paulb@274 | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
paulb@274 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
paulb@274 | 13 | Lesser General Public License for more details. |
paulb@274 | 14 | |
paulb@274 | 15 | You should have received a copy of the GNU Lesser General Public |
paulb@274 | 16 | License along with this library; if not, write to the Free Software |
paulb@412 | 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
paulb@274 | 18 | --> |
paulb@50 | 19 | <xsl:stylesheet version="1.0" |
paulb@50 | 20 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
paulb@50 | 21 | xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias" |
paulb@50 | 22 | xmlns:template="http://www.boddie.org.uk/ns/xmltools/template" |
paulb@50 | 23 | xmlns:dyn="http://exslt.org/dynamic" |
paulb@50 | 24 | extension-element-prefixes="dyn"> |
paulb@50 | 25 | |
paulb@50 | 26 | <xsl:output indent="yes"/> |
paulb@50 | 27 | <xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/> |
paulb@50 | 28 | |
paulb@50 | 29 | <xsl:param name="element-id"/> |
paulb@50 | 30 | |
paulb@50 | 31 | |
paulb@50 | 32 | |
paulb@50 | 33 | <!-- Start at the top, finding only the specified element. --> |
paulb@50 | 34 | |
paulb@50 | 35 | <xsl:template match="/"> |
paulb@50 | 36 | <axsl:stylesheet version="1.0" |
paulb@50 | 37 | xmlns:dyn="http://exslt.org/dynamic" |
paulb@50 | 38 | extension-element-prefixes="dyn"> |
paulb@50 | 39 | |
paulb@50 | 40 | <axsl:output indent="yes"/> |
paulb@50 | 41 | <axsl:param name="element-path"/> |
paulb@50 | 42 | |
paulb@50 | 43 | <!-- NOTE: Hard-coded doctypes to hopefully satisfy JavaScript code. --> |
paulb@50 | 44 | <!-- doctype-public="-//W3C//DTD XHTML 1.1//EN" |
paulb@50 | 45 | doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" --> |
paulb@50 | 46 | |
paulb@50 | 47 | <axsl:template match="/"> |
paulb@50 | 48 | |
paulb@50 | 49 | <!-- Include the remaining attributes. --> |
paulb@50 | 50 | <xsl:apply-templates select="@*"/> |
paulb@50 | 51 | |
paulb@50 | 52 | <!-- Process the elements. --> |
paulb@93 | 53 | <xsl:for-each select="//*[@template:id=$element-id]"> |
paulb@61 | 54 | <axsl:for-each select="dyn:evaluate($element-path)"> |
paulb@50 | 55 | <xsl:copy> |
paulb@50 | 56 | <xsl:apply-templates select="@*|node()"/> |
paulb@50 | 57 | </xsl:copy> |
paulb@61 | 58 | </axsl:for-each> |
paulb@61 | 59 | </xsl:for-each> |
paulb@50 | 60 | |
paulb@50 | 61 | </axsl:template> |
paulb@50 | 62 | </axsl:stylesheet> |
paulb@50 | 63 | </xsl:template> |
paulb@50 | 64 | |
paulb@50 | 65 | |
paulb@50 | 66 | |
paulb@50 | 67 | <!-- Replicate unknown elements. --> |
paulb@50 | 68 | |
paulb@50 | 69 | <xsl:template match="@*|node()"> |
paulb@50 | 70 | <xsl:copy> |
paulb@50 | 71 | <xsl:apply-templates select="@*|node()"/> |
paulb@50 | 72 | </xsl:copy> |
paulb@50 | 73 | </xsl:template> |
paulb@50 | 74 | |
paulb@50 | 75 | </xsl:stylesheet> |