Skip to content

Design Patterns

Balazs Meszaros edited this page Mar 14, 2017 · 1 revision

Overview

On this page, some design patterns for XSLT programming in DISCO will be listed.

Copy entire document

This is not an actual design pattern, but very important for a regular XSLT template in DISCO: it will copy the entire XML document with all its data. The reason why it is important is this: after executing an XSLT template, DISCO replaces the entire XML document from before the execution with the new output from the XSLT template. If properties should be read by other components or this very same component is to be called later in a different state, there has to be a valid XML document with meaningful data. For this reason, the easiest thing to do right at the beginning of the template is copying the entire XML document with this code:

    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

Clone this wiki locally