view gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl @ 409:df78178e1180

Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this. gnv/trunk@599 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 22 Jan 2010 11:28:25 +0000
parents d812c5b62eb4
children 0ce07c6e132c
line wrap: on
line source
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                xmlns="http://www.w3.org/2002/xforms" 
                xmlns:xform="http://www.w3.org/2002/xforms" 
                xmlns:art="http://www.intevation.de/2009/artifacts">
    <xsl:output method="html" version="1.0" encoding="UTF-8" omit-xml-declaration="no"/>
    
    <xsl:template match="*[local-name() = 'select']">
        <xsl:variable name="selectName" select="@ref"/>
	                <legend><xsl:value-of select="*[local-name() = 'label']"/></legend>
	                <select name="{$selectName}" multiple="multiple" size="6"> <xsl:apply-templates/></select>
	                <br/>
    </xsl:template>
    <xsl:template match="*[local-name() = 'select1']">
        <xsl:variable name="selectName" select="@ref"/>
                    <legend><xsl:value-of select="*[local-name() = 'label']"/></legend>
                    <select name="{$selectName}"> <xsl:apply-templates/></select>
                    <br/>
    </xsl:template>
    <xsl:template match="*[local-name() = 'item']">
        <xsl:variable name="optionValue" select="*[local-name() = 'value']"/>
        <xsl:choose>
           <xsl:when test="@selected = 'true'">
               <option value="{$optionValue}" selected="selected"><xsl:value-of select="*[local-name() = 'label']"></xsl:value-of></option>
           </xsl:when>
           <xsl:otherwise>
               <option value="{$optionValue}"><xsl:value-of select="*[local-name() = 'label']"></xsl:value-of></option>
           </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    
    <xsl:template match="*[local-name() = 'group']">
        <xsl:variable name="selectName" select="@ref"/>
                    <legend><xsl:value-of select="*[local-name() = 'label']"/></legend>
                    <xsl:apply-templates/>
    </xsl:template>
    
    <xsl:template match="*[local-name() = 'input']">
        <xsl:variable name="inputValue" select="*[local-name() = 'value']"/>
        <xsl:variable name="inputName" select="@ref"/>
        
        <!-- TODO: Remove this when we have the GIS interface. (slt) -->
        <xsl:choose>
            <xsl:when test="$inputName = 'mesh_linestring'">
                <a href="javascript:copy_demo_wkt_line();"><xsl:text>Beispiel WKT-Linestring einf&#252;gen:</xsl:text></a><br/>
            </xsl:when>
            <xsl:when test="$inputName = 'mesh_polygon'">
                <a href="javascript:copy_demo_wkt_polygon();"><xsl:text>Beispiel WKT-Polygon einf&#252;gen:</xsl:text></a><br/>
            </xsl:when>
        </xsl:choose>

        <xsl:choose>
           <xsl:when test="*[local-name() = 'label']!= ''">
               <xsl:value-of select="*[local-name() = 'label']"/>: 
           </xsl:when>
        </xsl:choose>

        <input type="text" id="{$inputName}" name="{$inputName}" value="{$inputValue}" /><br/> 
    </xsl:template>
    
    <xsl:template match="*[local-name() = 'label']">
    </xsl:template>
</xsl:stylesheet>

http://dive4elements.wald.intevation.org