Ignore:
Timestamp:
2010-11-01T10:03:17+13:00 (13 years ago)
Author:
sjb48
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/oran/transform/layouts/xml-to-gui.xsl

    r23135 r23255  
    5454    <xsl:template name="meta-to-combo">
    5555        <xsl:param name="metadataSets" select='.'/>
    56         <xsl:param name="current" select='.'/>
     56        <xsl:param name="current" select='.'/> 
    5757
    5858        <xsl:variable name="current_mod">
    5959            <xsl:choose>
    6060                <xsl:when test="contains($current,'.')"><xsl:value-of select="$current"/></xsl:when>
    61                 <xsl:otherwise>ex.<xsl:value-of select="$current"/></xsl:otherwise>
     61                <xsl:when test="$current!=''">ex.<xsl:value-of select="$current"/></xsl:when>
     62                <xsl:otherwise>ex.Title</xsl:otherwise>
    6263            </xsl:choose>
    6364        </xsl:variable>
    6465
    65         <select>
    66             <!-- <option value ="{$current_mod}" disabled="disabled" selected="{$current_mod}"><xsl:value-of select="$current_mod"/></option> -->
    67 
    68             <xsl:apply-templates select="$metadataSets" mode="meta-to-combo">
    69                 <xsl:with-param name="current" select="$current_mod"/>
    70             </xsl:apply-templates>
    71         </select>
     66        <xsl:variable name="exists">
     67        <xsl:apply-templates select="$metadataSets" mode="search-meta-to-combo">
     68            <xsl:with-param name="current" select="$current_mod"/> <!--<xsl:copy-of select="$current_mod"/></xsl:with-param> -->
     69        </xsl:apply-templates>
     70        </xsl:variable>
     71
     72        <xsl:choose>
     73            <xsl:when test="$exists='TRUE'">
     74                <select>
     75                    <xsl:apply-templates select="$metadataSets" mode="meta-to-combo">
     76                        <xsl:with-param name="current" select="$current_mod"/>
     77                    </xsl:apply-templates>
     78                </select>
     79            </xsl:when>
     80            <xsl:otherwise>
     81                <xsl:value-of select="$current_mod"/>
     82            </xsl:otherwise>
     83        </xsl:choose>
     84
     85    </xsl:template>
     86
     87    <xsl:template match="metadataSet" mode="search-meta-to-combo">
     88        <xsl:param name="current"/>
     89
     90        <xsl:variable name="set"><xsl:value-of select="substring-before($current, '.')"/></xsl:variable>
     91
     92        <xsl:if test="@name=$set">
     93        <xsl:apply-templates select="metadata" mode="search-meta-to-combo">
     94            <!-- <xsl:with-param name="set" select="@name"/> --> <!-- name of the set -->
     95            <xsl:with-param name="current" select="$current"/>
     96        </xsl:apply-templates>
     97        </xsl:if>
     98    </xsl:template>
     99
     100    <xsl:template match="metadata" mode="search-meta-to-combo">
     101        <xsl:param name="current"/>
     102        <xsl:variable name="cur"><xsl:value-of select="substring-after($current, '.')"/></xsl:variable>
     103        <xsl:if test="@name=$cur">TRUE</xsl:if>
     104    </xsl:template>
     105
     106    <xsl:template match="*" mode="search-meta-to-combo">
     107        <xsl:param name="current"/>
     108        <xsl:apply-templates mode="search-meta-to-combo">
     109            <xsl:with-param name="current" select="$current"/>
     110        </xsl:apply-templates>
    72111    </xsl:template>
    73112
     
    76115
    77116        <xsl:apply-templates mode="meta-to-combo">
    78             <xsl:with-param name="set" select="@name"/>
     117            <xsl:with-param name="set" select="@name"/> <!-- name of the set -->
    79118            <xsl:with-param name="current" select="$current"/>
    80119        </xsl:apply-templates>
     
    87126        <xsl:variable name="meta"><xsl:value-of select="$set"/>.<xsl:value-of select="@name"/></xsl:variable>
    88127
    89         <!-- if this is the current value, then set combo box to this value -->
    90128        <xsl:choose>
    91129            <xsl:when test="$current = $meta">
     
    134172        <xsl:param name="metadataSets"/>
    135173
     174        <!-- DEBUG metadata: <xsl:value-of select="@name"/>eol -->
     175
    136176        <div class="gsf_metadata css_gsf_metadata block leaf" title="gsf:metadata">
    137177            <xsl:variable name="combo">
     
    192232        <xsl:param name="depth"/>
    193233        <xsl:param name="metadataSets"/>
    194 
    195             <!-- CHILD = <xsl:value-of select="child[1]/@name"/> -->
    196             <!-- CHILD = <xsl:value-of select="child::*[name()][1]"/> -->
    197 
    198 
    199             <!-- <xsl:for-each select="child::*"> -->
    200             <!-- <xsl:value-of select="name()"/> -->
    201             <!-- </xsl:for-each> -->
    202 
    203234
    204235        <div class="gsf_template css_gsf_template block" title="gsf:template">
     
    211242            </xsl:variable>
    212243   
    213                     <!-- <a href="#" class="minmax">[+]</a><a href="#" class="remove">[x]</a><a href="#" class="remove"><img src="interfaces/oran/images/green_button_close.png" alt="[x]" title="Click me to remove"/></a><a href="[myhref]" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-home" style="float:left;"></span>Home</a> -->
    214244            <table class="header"><tbody><tr><td class="header">MATCH=<input type="text" name="rawtextinput" size="10" value="{@match}"/></td><td class="header"><xsl:copy-of select="$mode"/></td><td class="header"><a href="#" class="minmax ui-icon ui-icon-plusthick" title="Click me to expand">[+]</a></td><td class="header"><a href="#" class="remove ui-icon ui-icon-closethick" title="Click me to remove"/></td></tr></tbody></table>
    215245
     
    264294
    265295        <div class="gsf_otherwise css_gsf_otherwise block" title="gsf:otherwise">
    266                 <table class="header"><tbody><tr><td class="header">OTHERWISE</td><td class="header"><a href="#" class="minmax ui-icon ui-icon-minusthick">[-]</a></td><td class="header"><a href="#" class="remove">[x]</a></td><td><a href="[myhref]" class="ui-icon ui-icon-closethick"/></td></tr></tbody></table>
     296                <table class="header"><tbody><tr><td class="header">OTHERWISE</td><td class="header"><a href="#" class="minmax ui-icon ui-icon-minusthick">[-]</a></td><td class="header"><a href="#" class="remove">[x]</a></td><td><a href="#" class="ui-icon ui-icon-closethick"/></td></tr></tbody></table>
    267297                <xsl:apply-templates mode="xml-to-gui">
    268298                    <xsl:with-param name="depth" select="$depth"/>
Note: See TracChangeset for help on using the changeset viewer.