<?xml version="1.0" encoding="UTF-8"?>
<!-- 
This sample program is provided AS IS and may be used, executed, copied and
modified without royalty payment by customer (a) for its own instruction and
study, (b) in order to develop applications designed to run with an IBM
WebSphere product, either for customer's own internal use or for redistribution
by customer, as part of such an application, in customer's own products. 

5724-J34 (C) COPYRIGHT International Business Machines Corp. 2011
All Rights Reserved * Licensed Materials - Property of IBM
-->
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:dp="http://www.datapower.com/extensions"
    extension-element-prefixes="dp"
    exclude-result-prefixes="dp">
    
    <xsl:import href="cache-util.xsl" />
    
    <xsl:template match="/">
        
        <xsl:variable name="type" select="dp:variable('var://context/cache/type')" />
        <xsl:variable name="key" select="dp:variable('var://context/cache/key')" />
        <xsl:variable name="ttl" select="dp:variable('var://context/cache/ttl')" />
        
        <xsl:if test="$type">
            <xsl:variable name="cache-result">
                <xsl:call-template name="cacheSet">
                    <xsl:with-param name="type" select="$type" />
                    <xsl:with-param name="key" select="$key" />
                    <xsl:with-param name="ttl" select="$ttl" />
                    <xsl:with-param name="data" select="/" />
                </xsl:call-template>
            </xsl:variable>
        </xsl:if>
        
        <xsl:copy-of select="."/>
        
    </xsl:template>
    
</xsl:stylesheet>

