7 4 1 Payload Wrapper XSL stylesheet

LANSA WAM

7.4.1 Payload Wrapper XSL stylesheet

The LANSA Editor uses a Payload Wrapper" XSL stylesheet to transform a field or list TSML node and get the contents to add to the design.

The Payload Wrapper XSL imports the WebRoutine TSP stylesheet (for the currently active TSP). The output of this XSL is the contents that the LANSA Editor needs to add to the design (XSL imports, lxml data nodes, XSL for the field or list)

Note that the Payload Wrapper expects some XSL templates to be defined in the WebRoutine TSP Stylesheet.

<?xml version="1.0" encoding="UTF-8"?>
 
<!-- (c) 2002, 2013 LANSA                          -->
<!-- WAM Editor TSP Stylesheet Wrapper             -->
<!-- $Workfile:: tsp_payload_wrapper.xsl         $ -->
<!-- $Revision:: 3                               $ -->
 
<xsl:transform version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:xslt="http://www.lansa.com/2002/XSL/Transform-Alias"
        xmlns:lxml="http://www.lansa.com/2002/XML/Runtime-Data"
        xmlns:tsml="http://www.lansa.com/2002/XML/Generation-Metadata"
        xmlns:wd="http://www.lansa.com/2002/XSL/Weblet-Design"
        xmlns:lansa_design="http://www.lansa.com/2002/XML/Design"
        xmlns="http://www.w3.org/1999/xhtml"
        exclude-result-prefixes="tsml">
 
    <xsl:import href="%tsp_webroutine%.xsl"/>
 
    <xsl:output method="xml" omit-xml-declaration="no"
                    encoding="UTF-8" indent="yes"/>
    <xsl:namespace-alias stylesheet-prefix="xslt" result-prefix="xsl"/>
 
    <xsl:template match="tsml:data[@full-document = 'false']">
    <lansa_design:payload xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:lxml="http://www.lansa.com/2002/XML/Runtime-Data"
        xmlns:wd="http://www.lansa.com/2002/XSL/Weblet-Design"
        xmlns:lansa_design="http://www.lansa.com/2002/XML/Design"
        xmlns="http://www.w3.org/1999/xhtml">
 
    <lansa_design:imports>
    <xsl:call-template name="weblet-imports"/>
    </lansa_design:imports>
 
    <xsl:apply-templates select="tsml:lxml-data"/>
 
    <lansa_design:content>
    <xsl:apply-templates select="*[not(self::tsml:lxml-data)]"/>
    </lansa_design:content>
    </lansa_design:payload>
    </xsl:template>
 
    <xsl:template match="tsml:lxml-data">
    <lansa_design:lxml-data>
    <xsl:apply-imports />
    </lansa_design:lxml-data>
    </xsl:template>
 
    <xsl:template match="tsml:fields">
    <xsl:apply-templates select="tsml:field" />
    </xsl:template>
 
    <xsl:template match="tsml:field">
    <lansa_design:label>
    <xsl:if test="(tsml:mode != 'hidden') and (tsml:mode != 'private')">
    <xsl:call-template name="field-caption">
    <xsl:with-param name="field" select="."/>
    </xsl:call-template>
    </xsl:if>
    </lansa_design:label>
    <lansa_design:value>
    <xsl:if test="tsml:mode != 'private'">
    <xsl:call-template name="field-value">
    <xsl:with-param name="field" select="."/>
    </xsl:call-template>
    </xsl:if>
    </lansa_design:value>
    </xsl:template>
 
    <xsl:template match="tsml:lists[not(@column-only)]">
    <lansa_design:reference>
    <xsl:apply-imports />
    </lansa_design:reference>
    <lansa_design:implementation>
    <xsl:apply-templates select="tsml:list" mode="template_definition"/>
    </lansa_design:implementation>
    </xsl:template>
    
    <xsl:template match="tsml:lists[@column-only]">
    <xsl:apply-templates select="tsml:list"/>
    </xsl:template>
 
    <xsl:template match="tsml:lists[@column-only]/tsml:list">
    <lansa_design:value>
    <xsl:variable name="inline_list"
            select="(@inline = 'true') or ((@inline = 'default') and $g_inline_lists)"/>
    <xsl:apply-templates select="./tsml:list-entries/tsml:entry/tsml:column"
            mode="column_placement">
    <xsl:with-param name="inline_list" select="$inline_list"/>
    </xsl:apply-templates>
    </lansa_design:value>
    </xsl:template>
</xsl:transform>