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@330 | 7 | This library is free software; you can redistribute it and/or |
paulb@330 | 8 | modify it under the terms of the GNU Lesser General Public |
paulb@330 | 9 | License as published by the Free Software Foundation; either |
paulb@330 | 10 | version 2.1 of the License, or (at your option) any later version. |
paulb@330 | 11 | |
paulb@330 | 12 | This library is distributed in the hope that it will be useful, |
paulb@330 | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
paulb@330 | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
paulb@330 | 15 | Lesser General Public License for more details. |
paulb@330 | 16 | |
paulb@330 | 17 | You should have received a copy of the GNU Lesser General Public |
paulb@330 | 18 | License along with this library; if not, write to the Free Software |
paulb@330 | 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
paulb@330 | 20 | --> |
paulb@330 | 21 | <xsl:stylesheet version="1.0" |
paulb@330 | 22 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
paulb@330 | 23 | |
paulb@330 | 24 | <xsl:output indent="yes" omit-xml-declaration="yes"/> |
paulb@330 | 25 | <xsl:param name="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@330 | 34 | <!-- xsl:copy-of select="class"/> |
paulb@330 | 35 | <widget class="QWidget"> |
paulb@330 | 36 | <property name="name"> |
paulb@330 | 37 | <cstring><xsl:value-of select="class/text()"/></cstring> |
paulb@330 | 38 | </property --> |
paulb@330 | 39 | <xsl:apply-templates select="//widget[property[@name='name' and cstring/text() = $widget-name]]"/> |
paulb@330 | 40 | <!-- /widget --> |
paulb@330 | 41 | <xsl:apply-templates select="connections"/> |
paulb@330 | 42 | <xsl:copy-of select="slots"/> |
paulb@330 | 43 | <xsl:copy-of select="layoutdefaults"/> |
paulb@330 | 44 | </xsl:copy> |
paulb@330 | 45 | </xsl:template> |
paulb@330 | 46 | |
paulb@330 | 47 | <xsl:template match="widget"> |
paulb@330 | 48 | <xsl:copy> |
paulb@330 | 49 | <xsl:copy-of select="@class|*"/> |
paulb@330 | 50 | </xsl:copy> |
paulb@330 | 51 | </xsl:template> |
paulb@330 | 52 | |
paulb@330 | 53 | <xsl:template match="connections"> |
paulb@330 | 54 | <xsl:copy> |
paulb@330 | 55 | <xsl:copy-of select="connection[sender/text() = $widget-name or receiver/text() = $widget-name]"/> |
paulb@330 | 56 | </xsl:copy> |
paulb@330 | 57 | </xsl:template> |
paulb@330 | 58 | |
paulb@330 | 59 | |
paulb@330 | 60 | |
paulb@330 | 61 | <!-- Copy attributes. --> |
paulb@330 | 62 | |
paulb@330 | 63 | <xsl:template match="@*"> |
paulb@330 | 64 | <xsl:copy> |
paulb@330 | 65 | <xsl:apply-templates select="node()"/> |
paulb@330 | 66 | </xsl:copy> |
paulb@330 | 67 | </xsl:template> |
paulb@330 | 68 | |
paulb@330 | 69 | </xsl:stylesheet> |