Public feed
#891777
<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- whole document --> <xsl:template match="/"> <xsl:call-template name="recurse"/> </xsl:template> <!-- Recurses down the tree looking for inherting elements --> <xsl:template name="recurse"> <xsl:choose > <xsl:when test="@inherits"> <xsl:call-template name="inherits"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="noInherits"/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name ="inherits"> <!--Copy child element attributes, except 'inherits'--> <xsl:for-each select="@*"> <xsl:if test="name(.) != 'inherits'"> <xsl:copy/> </xsl:if> </xsl:for-each> <!-- Should we go fetch attributes on the base element class here maybe?--> <!-- Put child elements first--> <xsl:for-each select="./*"> <xsl:copy> <xsl:call-template name="recurse"/> </xsl:copy> </xsl:for-each> <!--Now we need to copy the elements from the base class specified by id--> <xsl:variable name="BaseClass" select="@inherits"></xsl:variable> <xsl:copy-of select="//*[@id=$BaseClass]/*"/> </xsl:template><!--This template deals with elements that do not inherit--> <xsl:template name ="noInherits"> <!--Copy child element attributes--> <xsl:for-each select="@*"> <xsl:copy/> </xsl:for-each> <!-- Put child elements--> <xsl:for-each select="./*"> <xsl:copy> <xsl:call-template name="recurse"/> </xsl:copy> </xsl:for-each> </xsl:template></xsl:stylesheet>