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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 <xsl:variable name="widget" select="//widget[property[@name='name' and cstring/text() = $widget-name]]"/> 27 28 29 30 <!-- Start at the top, producing a template file. --> 31 32 <xsl:template match="UI"> 33 <xsl:copy> 34 <xsl:apply-templates select="@*"/> 35 <xsl:apply-templates select="$widget"/> 36 <xsl:apply-templates select="connections"/> 37 <xsl:copy-of select="slots"/> 38 <xsl:copy-of select="layoutdefaults"/> 39 </xsl:copy> 40 </xsl:template> 41 42 <xsl:template match="widget"> 43 <xsl:copy> 44 <xsl:copy-of select="@class|*"/> 45 </xsl:copy> 46 </xsl:template> 47 48 <xsl:template match="connections"> 49 <xsl:copy> 50 <xsl:for-each select="connection"> 51 <xsl:if test="$widget/descendant-or-self::widget[property[@name='name' and (cstring/text() = current()/receiver/text() or cstring/text() = current()/sender/text())]]"> 52 <xsl:copy-of select="."/> 53 </xsl:if> 54 </xsl:for-each> 55 </xsl:copy> 56 </xsl:template> 57 58 59 60 <!-- Copy attributes. --> 61 62 <xsl:template match="@*"> 63 <xsl:copy> 64 <xsl:apply-templates select="node()"/> 65 </xsl:copy> 66 </xsl:template> 67 68 </xsl:stylesheet>