blob: ee3527d834fe35b59d63bf98c4347d35d6d73fa3 [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
Author: Vadim Gritsenko "vgritsenko@apache.org"
CVS $Id$
-->
<xsp:page language="java"
xmlns:xsp="http://apache.org/xsp"
xmlns:xscript="http://apache.org/xsp/xscript/1.0"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:saxon="http://icl.com/saxon"
>
<page>
<title>XScript tests</title>
<content>
<h2>Creating Variables</h2>
<h3>Create Global Scope Variable</h3>
<xscript:variable scope="global" name="test">
<b>This is the content of the <u>global</u> scope variable.</b>
</xscript:variable>
<para>
The content of the test variable from global scope is:
<xscript:get scope="global" name="test"/>.
</para>
<para>
The content of the first test variable is:
<xscript:get name="test"/>.
</para>
<h3>Create Page Scope Variable</h3>
<xscript:variable scope="page" name="test">
<b>This is the content of the <u>page</u> scope variable.</b>
</xscript:variable>
<para>
The content of the test variable from page scope is:
<xscript:get scope="page" name="test"/>.
</para>
<para>
The content of the first test variable is:
<xscript:get name="test"/>.
</para>
<h3>Create Session Scope Variable</h3>
<xscript:variable scope="session" name="test">
<b>This is the content of the <u>session</u> scope variable.</b>
</xscript:variable>
<para>
The content of the test variable from session scope is:
<xscript:get scope="session" name="test"/>.
</para>
<para>
The content of the first test variable is:
<xscript:get name="test"/>.
</para>
<h3>Create Request Scope Variable</h3>
<xscript:variable scope="request" name="test">
<b>This is the content of the <u>request</u> scope variable.</b>
</xscript:variable>
<para>
The content of the test variable from request scope is:
<xscript:get scope="request" name="test"/>.
</para>
<para>
The content of the first test variable is:
<xscript:get name="test"/>.
</para>
<h2>Transformations</h2>
<h3>Transform with stylesheet variable</h3>
<xscript:variable name="stylesheet">
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<p align="right">
<xsl:value-of select="*"/>
<br/>(transformed by the stylesheet)
</p>
</xsl:template>
</xsl:stylesheet>
</xscript:variable>
<para>
The content of the first test variable transformed with stylesheet
variable:
<xscript:transform name="test" stylesheet="stylesheet"/>
</para>
<h3>Copy of test variable</h3>
<para>
Copy of the test variable is:
<xscript:copy-of name="test"/>
</para>
<para>
Copy of the /b/u part of the test variable is:
<xscript:copy-of name="test" select="/b/u"/>.
</para>
<h2>Removing Variables</h2>
<h3>Remove Request Scope Variable</h3>
<xscript:remove scope="request" name="test"/>
<para>
The content of the test variable from request scope is:
<xscript:get scope="request" name="test"/>.
</para>
<para>
The content of the first test variable is:
<xscript:get name="test"/>.
</para>
<h3>Remove Session Scope Variable</h3>
<xscript:remove scope="session" name="test"/>
<para>
The content of the test variable from session scope is:
<xscript:get scope="session" name="test"/>.
</para>
<para>
The content of the first test variable is:
<xscript:get name="test"/>.
</para>
<h3>Remove Page Scope Variable</h3>
<xscript:remove scope="page" name="test"/>
<para>
The content of the test variable from page scope is:
<xscript:get scope="page" name="test"/>.
</para>
<para>
The content of the first test variable is:
<xscript:get name="test"/>.
</para>
<h3>Remove Global Scope Variable</h3>
<xscript:remove scope="global" name="test"/>
<para>
The content of the test variable from global scope is:
<xscript:get scope="global" name="test"/>.
</para>
<para>
The content of the first test variable is:
<xscript:get name="test"/>.
</para>
</content>
</page>
</xsp:page>