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