expand.xsl

Go to the documentation of this file.
00001 <?xml version="1.0" encoding="UTF-8" ?>
00002 <!-- $Id: expand.xsl,v 1.12 2004/08/24 17:23:10 ensonic Exp $
00003  * @file   expand.xsl
00004  * @author Stefan Kost <ensonic@users.sf.net>
00005  * @date   Thu Jan 17 11:22:38 2002
00006  * 
00007  * @brief  inserts default values into dialogs
00008  * @ingroup gitkcoretransformation
00009  *
00010 -->
00011 <xsl:stylesheet version="1.0"
00012   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
00013   xmlns:giml="http://gitk.sourceforge.net/"
00014   xmlns:dc="http://purl.org/dc/elements/1.1/"
00015   xmlns:i18n="http://apache.org/cocoon/i18n/2.0"
00016   xmlns="http://gitk.sourceforge.net/"
00017   exclude-result-prefixes="giml">
00018 
00019   <xsl:output method="xml" doctype-system="http://gitk.sourceforge.net/giml.dtd"/>
00020 
00021   <xsl:template match="giml:widget">
00022     <xsl:copy>
00023       <xsl:copy-of select="@*"/>
00024       <xsl:variable name="type" select="./@type"/>
00025       <xsl:if test="count(@hasFocus)=0">
00026         <xsl:choose>
00027           <!-- if this element is the same as the first non-label -->
00028           <xsl:when test="@id=((//giml:widgetgroup/giml:widget[@type!='label'])[1])/@id">
00029             <xsl:attribute name="hasFocus">true</xsl:attribute>
00030           </xsl:when>
00031           <xsl:otherwise>
00032             <xsl:attribute name="hasFocus">false</xsl:attribute>
00033           </xsl:otherwise>
00034         </xsl:choose>
00035       </xsl:if>
00036       <xsl:if test="count(giml:disabled)=0">
00037         <giml:disabled>false</giml:disabled>
00038       </xsl:if>
00039       <xsl:if test="count(giml:required)=0">
00040         <giml:required>false</giml:required>
00041       </xsl:if>
00042       <xsl:if test="count(giml:value)=0">
00043         <xsl:choose>
00044           <xsl:when test="$type='characterinput'"><giml:value/></xsl:when>
00045           <xsl:when test="$type='characterinput_alphabetic'"><giml:value/></xsl:when>
00046           <xsl:when test="$type='optionchoice'"><giml:value>0</giml:value></xsl:when>
00047           <xsl:when test="$type='optionchoice_single'"><giml:value>0</giml:value></xsl:when>
00048           <xsl:when test="$type='optionchoice_single_compact'"><giml:value>0</giml:value></xsl:when>
00049           <xsl:otherwise><giml:value/></xsl:otherwise>
00050         </xsl:choose>
00051       </xsl:if>
00052       <xsl:apply-templates/>
00053     </xsl:copy>
00054   </xsl:template>
00055 
00056   <xsl:template match="giml:meta">
00057     <xsl:copy>
00058       <xsl:copy-of select="@*"/>
00059       <xsl:if test="count(dc:title)=0">
00060         <dc:title>unnamed</dc:title>
00061       </xsl:if>
00062       <xsl:apply-templates/>
00063     </xsl:copy>
00064   </xsl:template>
00065 
00066   <xsl:template match="giml:dialog">
00067     <xsl:copy>
00068       <xsl:copy-of select="@*"/>
00069       <xsl:if test="count(@focus)=0">
00070         <xsl:attribute name="focus">main</xsl:attribute>
00071       </xsl:if>
00072       <xsl:if test="count(giml:meta)=0">
00073         <giml:meta>
00074           <dc:title>unnamed</dc:title>
00075         </giml:meta>
00076       </xsl:if>
00077       <xsl:if test="count(giml:widgetgroup)=0">
00078         <giml:widgetgroup/>
00079       </xsl:if>
00080       <xsl:apply-templates/>
00081     </xsl:copy>
00082   </xsl:template>
00083 
00084   <xsl:template match="@*|node()">
00085     <xsl:copy>
00086       <xsl:apply-templates select="@*|node()"/>
00087     </xsl:copy>
00088   </xsl:template>
00089 
00090 </xsl:stylesheet>

Generated on Thu Oct 28 10:59:07 2004 for gitk by doxygen 1.3.6