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