paulb@50 | 1 | <?xml version="1.0"?> |
paulb@50 | 2 | <xsl:stylesheet version="1.0" |
paulb@50 | 3 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
paulb@50 | 4 | xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias" |
paulb@50 | 5 | xmlns:template="http://www.boddie.org.uk/ns/xmltools/template" |
paulb@50 | 6 | xmlns:dyn="http://exslt.org/dynamic" |
paulb@50 | 7 | extension-element-prefixes="dyn"> |
paulb@50 | 8 | |
paulb@50 | 9 | <xsl:output indent="yes"/> |
paulb@50 | 10 | <xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/> |
paulb@50 | 11 | |
paulb@50 | 12 | <xsl:param name="element-id"/> |
paulb@50 | 13 | |
paulb@50 | 14 | |
paulb@50 | 15 | |
paulb@50 | 16 | <!-- Start at the top, finding only the specified element. --> |
paulb@50 | 17 | |
paulb@50 | 18 | <xsl:template match="/"> |
paulb@50 | 19 | <axsl:stylesheet version="1.0" |
paulb@50 | 20 | xmlns:dyn="http://exslt.org/dynamic" |
paulb@50 | 21 | extension-element-prefixes="dyn"> |
paulb@50 | 22 | |
paulb@50 | 23 | <axsl:output indent="yes"/> |
paulb@50 | 24 | <axsl:param name="element-path"/> |
paulb@50 | 25 | |
paulb@50 | 26 | <!-- NOTE: Hard-coded doctypes to hopefully satisfy JavaScript code. --> |
paulb@50 | 27 | <!-- doctype-public="-//W3C//DTD XHTML 1.1//EN" |
paulb@50 | 28 | doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" --> |
paulb@50 | 29 | |
paulb@50 | 30 | <axsl:template match="/"> |
paulb@50 | 31 | |
paulb@50 | 32 | <!-- Include the remaining attributes. --> |
paulb@50 | 33 | <xsl:apply-templates select="@*"/> |
paulb@50 | 34 | |
paulb@50 | 35 | <!-- Process the elements. --> |
paulb@93 | 36 | <xsl:for-each select="//*[@template:id=$element-id]"> |
paulb@61 | 37 | <axsl:for-each select="dyn:evaluate($element-path)"> |
paulb@50 | 38 | <xsl:copy> |
paulb@50 | 39 | <xsl:apply-templates select="@*|node()"/> |
paulb@50 | 40 | </xsl:copy> |
paulb@61 | 41 | </axsl:for-each> |
paulb@61 | 42 | </xsl:for-each> |
paulb@50 | 43 | |
paulb@50 | 44 | </axsl:template> |
paulb@50 | 45 | </axsl:stylesheet> |
paulb@50 | 46 | </xsl:template> |
paulb@50 | 47 | |
paulb@50 | 48 | |
paulb@50 | 49 | |
paulb@50 | 50 | <!-- Replicate unknown elements. --> |
paulb@50 | 51 | |
paulb@50 | 52 | <xsl:template match="@*|node()"> |
paulb@50 | 53 | <xsl:copy> |
paulb@50 | 54 | <xsl:apply-templates select="@*|node()"/> |
paulb@50 | 55 | </xsl:copy> |
paulb@50 | 56 | </xsl:template> |
paulb@50 | 57 | |
paulb@50 | 58 | </xsl:stylesheet> |