You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by tv...@apache.org on 2009/12/03 15:22:05 UTC

svn commit: r886788 - in /incubator/pivot/trunk: README build.xml tutorials/www/windows.html tutorials/www/windows.xml tutorials/xsl/ tutorials/xsl/tutorial.xsl

Author: tvolkert
Date: Thu Dec  3 14:22:04 2009
New Revision: 886788

URL: http://svn.apache.org/viewvc?rev=886788&view=rev
Log:
Began work of migrating tutorials web pages to XML/XSLT

Added:
    incubator/pivot/trunk/tutorials/www/windows.xml
    incubator/pivot/trunk/tutorials/xsl/
    incubator/pivot/trunk/tutorials/xsl/tutorial.xsl
Removed:
    incubator/pivot/trunk/tutorials/www/windows.html
Modified:
    incubator/pivot/trunk/README
    incubator/pivot/trunk/build.xml

Modified: incubator/pivot/trunk/README
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/README?rev=886788&r1=886787&r2=886788&view=diff
==============================================================================
--- incubator/pivot/trunk/README (original)
+++ incubator/pivot/trunk/README Thu Dec  3 14:22:04 2009
@@ -79,7 +79,7 @@
 Documentation
 =============
 
-Pivot home page: http://incubator.apache.org/pivot
-Demos:           http://incubator.apache.org/pivot/1.4/demos/
-Tutorials:       http://incubator.apache.org/pivot/1.4/tutorials/
-Javadoc:         http://incubator.apache.org/pivot/1.4/docs/api/
+Pivot home page: http://pivot.apache.org/
+Demos:           http://pivot.apache.org/demos/
+Tutorials:       http://pivot.apache.org/tutorials/
+Javadoc:         http://pivot.apache.org/1.4/docs/api/

Modified: incubator/pivot/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/build.xml?rev=886788&r1=886787&r2=886788&view=diff
==============================================================================
--- incubator/pivot/trunk/build.xml (original)
+++ incubator/pivot/trunk/build.xml Thu Dec  3 14:22:04 2009
@@ -449,6 +449,7 @@
         <copy todir="demos/${folder.deploy}/lib">
             <fileset dir="${folder.lib}">
                 <include name="*.jar"/>
+                <exclude name="*-server*.jar"/>
             </fileset>
         </copy>
 
@@ -491,24 +492,39 @@
         </war>
 
         <!-- Deploy tutorials -->
-        <mkdir dir="tutorials/www/lib"/>
-        <copy todir="tutorials/www/lib">
+        <mkdir dir="tutorials/${folder.deploy}/lib"/>
+        <copy todir="tutorials/${folder.deploy}/lib">
             <fileset dir="${folder.lib}">
                 <include name="*.jar"/>
                 <exclude name="*-demos*.jar"/>
-                <exclude name="*.server.jar"/>
+                <exclude name="*-server*.jar"/>
             </fileset>
         </copy>
 
+        <!-- Transform tutorials html -->
+        <xslt basedir="tutorials/www"
+            destdir="tutorials/${folder.deploy}"
+            extension=".html"
+            style="tutorials/xsl/tutorial.xsl"
+            includes="*.xml"
+            excludes="index.xml">
+            <param name="release" expression="${version}"/>
+        </xslt>
+
+        <!-- Copy static tutorial files to deploy folder -->
+        <copy todir="tutorials/${folder.deploy}">
+            <fileset dir="tutorials/www" excludes="**/*.xml"/>
+        </copy>
+
         <!-- Generate tutorials version templates -->
-        <copy todir="tutorials/www" filtering="true">
+        <copy todir="tutorials/${folder.deploy}" filtering="true">
             <fileset dir="tutorials/www">
                 <include name="version.template.jsp"/>
             </fileset>
             <mapper type="glob" from="version.template.jsp" to="version.jsp"/>
         </copy>
 
-        <copy todir="tutorials/www" filtering="true">
+        <copy todir="tutorials/${folder.deploy}" filtering="true">
             <fileset dir="tutorials/www">
                 <include name="version.template.js"/>
             </fileset>

Added: incubator/pivot/trunk/tutorials/www/windows.xml
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/www/windows.xml?rev=886788&view=auto
==============================================================================
--- incubator/pivot/trunk/tutorials/www/windows.xml (added)
+++ incubator/pivot/trunk/tutorials/www/windows.xml Thu Dec  3 14:22:04 2009
@@ -0,0 +1,397 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<document>
+    <properties>
+        <title>Windows</title>
+        <next>clipboard</next>
+    </properties>
+
+    <body>
+        <p>
+            Though every tutorial example thus far has used windows, Pivot's actual window classes
+            have not yet been explicitly discussed. This is because, for many applications
+            (especially those that are browser-based), a single main application window is
+            sufficient. However, more complex applications often require multiple windows, allowing
+            a user to see and interact with a variety of information.
+        </p>
+
+        <p>
+            Though the root of the WTK component hierarchy is an instance of <tt>Display</tt>,
+            windows generally represent an application's primary entry point into the UI. Windows
+            are always direct descendants of the display. They represent a place on the screen
+            where the application can draw or place user interface elements.
+        </p>
+
+        <p>
+            The class diagram below shows the Pivot window class hierarchy (though it is not shown
+            in this diagram, Window actually extends Container, which extends Component, the root
+            of all WTK UI classes):
+        </p>
+
+        <p><img src="windows/windows.png"/></p>
+        <p class="caption">Window class hierarchy.</p>
+
+        <p>The following is a description of each window type:</p>
+
+        <ul>
+            <li>
+                <p>
+                    <b>Window</b> - Base window class; it is not abstract and is the most basic
+                    means by which content may be placed on the screen. It simply provides an
+                    undecorated region in which other components may be placed.
+                </p>
+            </li>
+            <li>
+                <p>
+                    <b>Frame</b> - A window with a title bar and border for dragging and resizing.
+                </p>
+            </li>
+            <li>
+                <p>
+                    <b>Dialog</b> - A frame that is generally used for collecting user input
+                    (engaging in a "dialog" with the user); may optionally be "modal", blocking
+                    input to its owner.
+                </p>
+            </li>
+            <li>
+                <p>
+                    <b>Alert</b> - A dialog that is generally used to present brief notifications
+                    to the user.
+                </p>
+            </li>
+            <li>
+                <p>
+                    <b>Sheet</b> - A window that, like a dialog, is generally used for collecting
+                    user input; however, unlike dialogs, sheets always have an owner, and are
+                    always modal over the owner's client area.
+                </p>
+            </li>
+            <li>
+                <p>
+                    <b>Prompt</b> - A sheet that is generally used to present brief notifications
+                    to the user; the sheet equivalent of <tt>Alert</tt>.
+                </p>
+            </li>
+            <li>
+                <p>
+                    <b>MenuPopup</b> - A "popup" window that is used to present a menu to the user.
+                    It can be used stand-alone as a context menu, but is also used by other
+                    components including <tt>MenuBar</tt> and <tt>MenuButton</tt>.
+                </p>
+            </li>
+            <li>
+                <p>
+                    <b>Palette</b> - A floating tool palette window.
+                </p>
+            </li>
+            <li>
+                <p>
+                    <b>FileBrowserSheet</b> - A sheet that allows the user to browse the local file
+                    system.
+                </p>
+            </li>
+            <li>
+                <p>
+                    <b>Tooltip</b> - A small, popup-like window that disappears as soon as the
+                    user moves the mouse.
+                </p>
+            </li>
+        </ul>
+
+        <p>
+            Most of the tutorial examples up to this point have used a single, maximized,
+            decorationless <tt>Window</tt> to host their example content, since this type of user
+            interface is well-suited to browser-based deployment as employed by this tutorial.
+            However, Pivot applications are not limited to this sort of interface. Just like a
+            native windowing toolkit, a Pivot application can open as many windows on the display
+            of as many different types as are required by the application.
+        </p>
+
+        <p>
+            The following sample application demonstrates each of these window types. It creates
+            three top-level frames, each of which contains buttons for launching several other
+            window types:
+        </p>
+
+        <application class="org.apache.pivot.tutorials.windows.Windows" width="100%" height="600">
+            <libraries>
+                <library>core</library>
+                <library>wtk</library>
+                <library>wtk-terra</library>
+                <library>tutorials</library>
+            </libraries>
+        </application>
+
+        <p>The content of each frame is defined in "frame.wtkx":</p>
+
+        <source type="xml">
+&lt;Frame wtkx:id="frame" icon="@application_form.png"
+    preferredWidth="480" preferredHeight="360"
+    xmlns:wtkx="http://pivot.apache.org/wtkx"
+    xmlns:content="org.apache.pivot.wtk.content"
+    xmlns="org.apache.pivot.wtk"&gt;
+    &lt;wtkx:define&gt;
+        &lt;wtkx:include wtkx:id="dialog" src="dialog.wtkx"/&gt;
+        &lt;wtkx:include wtkx:id="sheet" src="sheet.wtkx"/&gt;
+    &lt;/wtkx:define&gt;
+
+    &lt;wtkx:script&gt;
+    var palette = null;
+    &lt;/wtkx:script&gt;
+
+    &lt;content&gt;
+        &lt;BoxPane orientation="vertical"&gt;
+            &lt;PushButton buttonData="Show Alert"&gt;
+                &lt;buttonPressListeners&gt;
+                    &lt;wtkx:script&gt;
+                    &lt;![CDATA[
+                    importPackage(org.apache.pivot.wtk);
+                    function buttonPressed(button) {
+                        Alert.alert("This is an Alert.", frame);
+                    }
+                    ]]&gt;
+                    &lt;/wtkx:script&gt;
+                &lt;/buttonPressListeners&gt;
+            &lt;/PushButton&gt;
+
+            &lt;PushButton buttonData="Show Prompt"&gt;
+                &lt;buttonPressListeners&gt;
+                    &lt;wtkx:script&gt;
+                    &lt;![CDATA[
+                    importPackage(org.apache.pivot.wtk);
+                    function buttonPressed(button) {
+                        Prompt.prompt("This is a Prompt.", frame);
+                    }
+                    ]]&gt;
+                    &lt;/wtkx:script&gt;
+                &lt;/buttonPressListeners&gt;
+            &lt;/PushButton&gt;
+
+            &lt;PushButton buttonData="Show Dialog"&gt;
+                &lt;buttonPressListeners&gt;
+                    &lt;wtkx:script&gt;
+                    &lt;![CDATA[
+                    importPackage(org.apache.pivot.wtk);
+                    function buttonPressed(button) {
+                        dialog.open(frame, null);
+                    }
+                    ]]&gt;
+                    &lt;/wtkx:script&gt;
+                &lt;/buttonPressListeners&gt;
+            &lt;/PushButton&gt;
+
+            &lt;PushButton buttonData="Show Sheet"&gt;
+                &lt;buttonPressListeners&gt;
+                    &lt;wtkx:script&gt;
+                    &lt;![CDATA[
+                    importPackage(org.apache.pivot.wtk);
+                    function buttonPressed(button) {
+                        sheet.open(frame, null);
+                    }
+                    ]]&gt;
+                    &lt;/wtkx:script&gt;
+                &lt;/buttonPressListeners&gt;
+            &lt;/PushButton&gt;
+
+            &lt;PushButton buttonData="Show Palette"&gt;
+                &lt;buttonPressListeners&gt;
+                    &lt;wtkx:script&gt;
+                    &lt;![CDATA[
+                    importPackage(org.apache.pivot.wtk);
+                    function buttonPressed(button) {
+                        if (palette == null) {
+                            palette = application.load("palette.wtkx");
+                            palette.setLocation(frame.getX() + frame.getWidth() + 20, frame.getY() + 20);
+                        }
+
+                        palette.open(frame);
+                    }
+                    ]]&gt;
+                    &lt;/wtkx:script&gt;
+                &lt;/buttonPressListeners&gt;
+            &lt;/PushButton&gt;
+        &lt;/BoxPane&gt;
+    &lt;/content&gt;
+&lt;/Frame&gt;
+        </source>
+        <p class="caption">frame.wtkx</p>
+
+        <p>
+            This file includes several additional WTKX files that define the dialog, sheet, and
+            palette windows opened by the main frame:
+        </p>
+
+        <source type="xml">
+&lt;Dialog wtkx:id="dialog" title="Dialog"
+    xmlns:wtkx="http://pivot.apache.org/wtkx"
+    xmlns="org.apache.pivot.wtk"&gt;
+    &lt;content&gt;
+        &lt;TablePane preferredWidth="320" preferredHeight="210"&gt;
+            &lt;columns&gt;
+                &lt;TablePane.Column width="1*"/&gt;
+            &lt;/columns&gt;
+            &lt;rows&gt;
+                &lt;TablePane.Row height="1*"&gt;
+                    &lt;Label text="This is a dialog."
+                        preferredWidth="320" preferredHeight="210"
+                        styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/&gt;
+                &lt;/TablePane.Row&gt;
+                &lt;TablePane.Row height="-1"&gt;
+                    &lt;BoxPane styles="{horizontalAlignment:'right'}"&gt;
+                        &lt;PushButton buttonData="Close"
+                            ButtonPressListener.buttonPressed="dialog.close()"/&gt;
+                    &lt;/BoxPane&gt;
+                &lt;/TablePane.Row&gt;
+            &lt;/rows&gt;
+        &lt;/TablePane&gt;
+    &lt;/content&gt;
+&lt;/Dialog&gt;
+        </source>
+        <p class="caption">dialog.wtkx</p>
+
+        <source type="xml">
+&lt;Sheet wtkx:id="sheet" title="Sheet"
+    xmlns:wtkx="http://pivot.apache.org/wtkx"
+    xmlns="org.apache.pivot.wtk"&gt;
+    &lt;content&gt;
+        &lt;BoxPane styles="{verticalAlignment:'bottom'}"&gt;
+            &lt;TablePane&gt;
+                &lt;columns&gt;
+                    &lt;TablePane.Column width="1*"/&gt;
+                &lt;/columns&gt;
+                &lt;rows&gt;
+                    &lt;TablePane.Row height="1*"&gt;
+                        &lt;Label text="This is a sheet."
+                            preferredWidth="320" preferredHeight="210"
+                            styles="{horizontalAlignment:'center', verticalAlignment:'center'}"/&gt;
+                    &lt;/TablePane.Row&gt;
+                    &lt;TablePane.Row height="-1"&gt;
+                        &lt;BoxPane styles="{horizontalAlignment:'right'}"&gt;
+                            &lt;PushButton buttonData="Close"
+                                ButtonPressListener.buttonPressed="sheet.close()"/&gt;
+                        &lt;/BoxPane&gt;
+                    &lt;/TablePane.Row&gt;
+                &lt;/rows&gt;
+            &lt;/TablePane&gt;
+        &lt;/BoxPane&gt;
+    &lt;/content&gt;
+&lt;/Sheet&gt;
+        </source>
+        <p class="caption">sheet.wtkx</p>
+
+        <source type="xml">
+&lt;Palette title="Palette" preferredWidth="60" preferredHeight="120"
+    xmlns:wtkx="http://pivot.apache.org/wtkx"
+    xmlns="org.apache.pivot.wtk"&gt;
+    &lt;content&gt;
+        &lt;FlowPane styles="{padding:1}"&gt;
+            &lt;PushButton buttonData="1" styles="{toolbar:true, minimumAspectRatio:1, maximumAspectRatio:1}"/&gt;
+            &lt;PushButton buttonData="2" styles="{toolbar:true, minimumAspectRatio:1, maximumAspectRatio:1}"/&gt;
+            &lt;PushButton buttonData="3" styles="{toolbar:true, minimumAspectRatio:1, maximumAspectRatio:1}"/&gt;
+            &lt;PushButton buttonData="4" styles="{toolbar:true, minimumAspectRatio:1, maximumAspectRatio:1}"/&gt;
+            &lt;PushButton buttonData="5" styles="{toolbar:true, minimumAspectRatio:1, maximumAspectRatio:1}"/&gt;
+            &lt;PushButton buttonData="6" styles="{toolbar:true, minimumAspectRatio:1, maximumAspectRatio:1}"/&gt;
+        &lt;/FlowPane&gt;
+    &lt;/content&gt;
+&lt;/Palette&gt;
+        </source>
+        <p class="caption">palette.wtkx</p>
+
+        <p>
+            The application code simply instantiates three <tt>Frame</tt> objects and sets the
+            component read from the WTKX as the frames' contents:
+        </p>
+
+        <source type="java">
+package org.apache.pivot.tutorials.windows;
+
+import java.io.IOException;
+
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.serialization.SerializationException;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.DesktopApplicationContext;
+import org.apache.pivot.wtk.Display;
+import org.apache.pivot.wtk.Frame;
+import org.apache.pivot.wtk.Window;
+import org.apache.pivot.wtkx.WTKXSerializer;
+
+public class Windows implements Application {
+    private Display display = null;
+
+    @Override
+    public void startup(Display display, Map&lt;String, String&gt; properties) throws Exception {
+        this.display = display;
+
+        int x = 0;
+        int y = 0;
+
+        for (int i = 0; i &lt; 3; i++) {
+            WTKXSerializer wtkxSerializer = new WTKXSerializer();
+            wtkxSerializer.put("application", this);
+
+            Frame frame;
+            try {
+                frame = (Frame)wtkxSerializer.readObject(Windows.this, "frame.wtkx");
+            } catch (SerializationException exception) {
+                throw new RuntimeException(exception);
+            } catch (IOException exception) {
+                throw new RuntimeException(exception);
+            }
+
+            frame.setTitle("Frame " + (i + 1));
+            frame.setLocation(x, y);
+            x += 20;
+            y += 20;
+
+            frame.open(display);
+        }
+    }
+
+    @Override
+    public boolean shutdown(boolean optional) {
+        for (int i = display.getLength() - 1; i &gt;= 0; i--) {
+            Window window = (Window)display.get(i);
+            window.close();
+        }
+
+        return false;
+    }
+
+    @Override
+    public void suspend() {
+    }
+
+    @Override
+    public void resume() {
+    }
+
+    public Window load(String fileName)
+        throws SerializationException, IOException {
+        WTKXSerializer wtkxSerializer = new WTKXSerializer();
+        return (Window)wtkxSerializer.readObject(this, fileName);
+    }
+
+    public static void main(String[] args) {
+        DesktopApplicationContext.main(Windows.class, args);
+    }
+}
+        </source>
+    </body>
+</document>

Added: incubator/pivot/trunk/tutorials/xsl/tutorial.xsl
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/xsl/tutorial.xsl?rev=886788&view=auto
==============================================================================
--- incubator/pivot/trunk/tutorials/xsl/tutorial.xsl (added)
+++ incubator/pivot/trunk/tutorials/xsl/tutorial.xsl Thu Dec  3 14:22:04 2009
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<!-- Translates a tutorial XML document into an HTML tutorial page -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+    <xsl:param name="release"/>
+
+    <xsl:output method="html" encoding="UTF-8" indent="no"
+        doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
+
+    <!-- <document> gets translated into an HTML container -->
+    <xsl:template match="document">
+        <html xmlns="http://www.w3.org/1999/xhtml">
+            <head>
+                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+                <title>
+                    Pivot <xsl:value-of select="properties/title"/> Tutorial
+                </title>
+                <link rel="stylesheet" href="tutorial.css" type="text/css"/>
+                <script xmlns="" type="text/javascript" src="http://java.com/js/deployJava.js"/>
+
+                <!-- NOTE: Syntax highlighting script is LGPL -->
+                <script xmlns="" type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js"/>
+                <script xmlns="" type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js"/>
+                <script xmlns="" type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js"/>
+                <link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css"/>
+                <link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css"/>
+                <script type="text/javascript">
+                    SyntaxHighlighter.all();
+                </script>
+
+                <xsl:apply-templates select="head"/>
+            </head>
+
+            <body>
+                <h1><xsl:value-of select="properties/title"/></h1>
+                <xsl:apply-templates select="body"/>
+                <p>
+                    Next:
+                    <a href="{properties/next}.html">
+                      <!-- TODO Pull title from properties of next document -->
+                      <xsl:value-of select="properties/next"/>
+                    </a>
+                </p>
+            </body>
+        </html>
+    </xsl:template>
+
+    <!-- <head> content gets passed through -->
+    <xsl:template match="head">
+        <xsl:apply-templates/>
+    </xsl:template>
+
+    <!-- <body> content gets passed through -->
+    <xsl:template match="body">
+        <xsl:apply-templates/>
+    </xsl:template>
+
+    <!-- <application> gets translated to a JavaScript block that launches the applet -->
+    <xsl:template match="application">
+        <script type="text/javascript">
+            <!-- Base attributes -->
+            var attributes = {
+                code:'org.apache.pivot.wtk.BrowserApplicationContext$HostApplet',
+                width:'<xsl:value-of select="@width"/>',
+                height:'<xsl:value-of select="@height"/>'
+            };
+
+            <!-- Additional attributes -->
+            <xsl:for-each select="attributes/*">
+                attributes.<xsl:value-of select="name(.)"/> = "<xsl:value-of select="."/>";
+            </xsl:for-each>
+
+            <!-- Archive attribute -->
+            var libraries = [];
+            <xsl:variable name="signed" select="@signed"/>
+            <xsl:for-each select="libraries/library">
+                <xsl:text><![CDATA[libraries.push("]]></xsl:text>
+                <xsl:value-of select="'lib/pivot-'"/>
+                <xsl:value-of select="."/>
+                <xsl:value-of select="'-'"/>
+                <xsl:value-of select="$release"/>
+                <xsl:if test="$signed">
+                    <xsl:value-of select="'.signed'"/>
+                </xsl:if>
+                <xsl:value-of select="'.jar'"/>
+                <xsl:text><![CDATA[");
+                ]]></xsl:text>
+            </xsl:for-each>
+            attributes.archive = libraries.join(",");
+
+            <!-- Base parameters -->
+            var parameters = {
+                codebase_lookup:false,
+                java_arguments:'-Dsun.awt.noerasebackground=true -Dsun.awt.erasebackgroundonresize=true',
+                application_class_name:'<xsl:value-of select="@class"/>'
+            };
+
+            <!-- Startup properties -->
+            <xsl:if test="startup-properties">
+                var startupProperties = [];
+                <xsl:for-each select="startup-properties/*">
+                    startupProperties.push("<xsl:value-of select="name(.)"/>=<xsl:apply-templates/>");
+                </xsl:for-each>
+                parameters.startup_properties = startupProperties.join("&amp;");
+            </xsl:if>
+
+            deployJava.runApplet(attributes, parameters, "1.6");
+        </script>
+    </xsl:template>
+
+    <!-- <source> gets translated to pre-formatted source code block -->
+    <xsl:template match="source">
+        <xsl:element name="pre">
+            <xsl:attribute name="class">
+                <xsl:choose>
+                    <xsl:when test="@type='xml'">
+                        <xsl:text>brush:xml</xsl:text>
+                    </xsl:when>
+                    <xsl:when test="@type='java'">
+                        <xsl:text>brush:java</xsl:text>
+                    </xsl:when>
+                    <xsl:when test="@type='javascript'">
+                        <xsl:text>brush:javascript</xsl:text>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:text>brush</xsl:text>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:attribute>
+            <xsl:apply-templates/>
+        </xsl:element>
+    </xsl:template>
+
+    <!-- Everything else gets passed through -->
+    <xsl:template match="*|@*">
+        <xsl:copy>
+            <xsl:apply-templates select="@*|*|text()"/>
+        </xsl:copy>
+    </xsl:template>
+</xsl:stylesheet>