paulb@330 | 1 | <?xml version="1.0"?> |
paulb@330 | 2 | <!-- |
paulb@330 | 3 | An experimental Qt Designer widget extractor for use with QWidgetFactory. |
paulb@330 | 4 | |
paulb@330 | 5 | Copyright (C) 2005 Paul Boddie <paul@boddie.org.uk> |
paulb@330 | 6 | |
paulb@620 | 7 | This program is free software; you can redistribute it and/or modify it under |
paulb@620 | 8 | the terms of the GNU Lesser General Public License as published by the Free |
paulb@620 | 9 | Software Foundation; either version 3 of the License, or (at your option) any |
paulb@620 | 10 | later version. |
paulb@330 | 11 | |
paulb@620 | 12 | This program is distributed in the hope that it will be useful, but WITHOUT |
paulb@620 | 13 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
paulb@620 | 14 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
paulb@620 | 15 | details. |
paulb@330 | 16 | |
paulb@620 | 17 | You should have received a copy of the GNU Lesser General Public License along |
paulb@620 | 18 | with this program. If not, see <http://www.gnu.org/licenses/>. |
paulb@330 | 19 | --> |
paulb@330 | 20 | <xsl:stylesheet version="1.0" |
paulb@330 | 21 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
paulb@330 | 22 | |
paulb@330 | 23 | <xsl:output indent="yes" omit-xml-declaration="yes"/> |
paulb@330 | 24 | <xsl:param name="widget-name"/> |
paulb@337 | 25 | <xsl:variable name="widget" select="//widget[property[@name='name' and cstring/text() = $widget-name]]"/> |
paulb@330 | 26 | |
paulb@330 | 27 | |
paulb@330 | 28 | |
paulb@330 | 29 | <!-- Start at the top, producing a template file. --> |
paulb@330 | 30 | |
paulb@330 | 31 | <xsl:template match="UI"> |
paulb@330 | 32 | <xsl:copy> |
paulb@330 | 33 | <xsl:apply-templates select="@*"/> |
paulb@337 | 34 | <xsl:apply-templates select="$widget"/> |
paulb@330 | 35 | <xsl:apply-templates select="connections"/> |
paulb@330 | 36 | <xsl:copy-of select="slots"/> |
paulb@330 | 37 | <xsl:copy-of select="layoutdefaults"/> |
paulb@330 | 38 | </xsl:copy> |
paulb@330 | 39 | </xsl:template> |
paulb@330 | 40 | |
paulb@330 | 41 | <xsl:template match="widget"> |
paulb@330 | 42 | <xsl:copy> |
paulb@330 | 43 | <xsl:copy-of select="@class|*"/> |
paulb@330 | 44 | </xsl:copy> |
paulb@330 | 45 | </xsl:template> |
paulb@330 | 46 | |
paulb@330 | 47 | <xsl:template match="connections"> |
paulb@330 | 48 | <xsl:copy> |
paulb@337 | 49 | <xsl:for-each select="connection"> |
paulb@337 | 50 | <xsl:if test="$widget/descendant-or-self::widget[property[@name='name' and (cstring/text() = current()/receiver/text() or cstring/text() = current()/sender/text())]]"> |
paulb@337 | 51 | <xsl:copy-of select="."/> |
paulb@337 | 52 | </xsl:if> |
paulb@337 | 53 | </xsl:for-each> |
paulb@330 | 54 | </xsl:copy> |
paulb@330 | 55 | </xsl:template> |
paulb@330 | 56 | |
paulb@330 | 57 | |
paulb@330 | 58 | |
paulb@330 | 59 | <!-- Copy attributes. --> |
paulb@330 | 60 | |
paulb@330 | 61 | <xsl:template match="@*"> |
paulb@330 | 62 | <xsl:copy> |
paulb@330 | 63 | <xsl:apply-templates select="node()"/> |
paulb@330 | 64 | </xsl:copy> |
paulb@330 | 65 | </xsl:template> |
paulb@330 | 66 | |
paulb@330 | 67 | </xsl:stylesheet> |