coliver 2003/04/30 02:39:02
Modified: src/scratchpad/src/org/apache/cocoon/components/jxforms/flow
jxForm.js
src/scratchpad/src/org/apache/cocoon/generation
JXFormsGenerator.java
src/scratchpad/webapp/samples/petstore sitemap.xmap
src/scratchpad/webapp/samples/petstore/flow petstore.js
src/scratchpad/webapp/samples/petstore/stylesheets
form2html.xsl site2html.xsl
Added: src/scratchpad/webapp/samples/petstore/view/jxforms
EditAccountInformation.xml
EditProfileInformation.xml EditUserInformation.xml
Removed: src/scratchpad/webapp/samples/petstore/view/xmlform
EditAccountForm.xml
Log:
updated petstore to use jxforms
Revision Changes Path
1.5 +10 -7
cocoon-2.1/src/scratchpad/src/org/apache/cocoon/components/jxforms/flow/jxForm.js
Index: jxForm.js
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/scratchpad/src/org/apache/cocoon/components/jxforms/flow/jxForm.js,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- jxForm.js 28 Apr 2003 05:37:05 -0000 1.4
+++ jxForm.js 30 Apr 2003 09:39:01 -0000 1.5
@@ -231,17 +231,20 @@
}
/**
- * Sends view to presentation pipeline but doesn't wait for submission
+ * Optionally sends final view to presentation pipeline but doesn't wait for
+ * submission and then destroys internal state of this form
* @param uri [String] presentation pipeline uri
*/
JXForm.prototype.finish = function(uri) {
- this.form.remove(this.cocoon.environment.objectModel, this.id);
- this.form.save(this.cocoon.environment.objectModel, "request");
- this.cocoon.forwardTo("cocoon://" +
- this.cocoon.environment.getURIPrefix() + uri,
- this.form.getModel(),
- null);
+ if (uri != undefined) {
+ this.form.remove(this.cocoon.environment.objectModel, this.id);
+ this.form.save(this.cocoon.environment.objectModel, "request");
+ this.cocoon.forwardTo("cocoon://" +
+ this.cocoon.environment.getURIPrefix() + uri,
+ this.form.getModel(),
+ null);
+ }
this.dead = true;
if (this.rootContinuation != null) {
this.rootContinuation.invalidate();
1.5 +136 -51
cocoon-2.1/src/scratchpad/src/org/apache/cocoon/generation/JXFormsGenerator.java
Index: JXFormsGenerator.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/scratchpad/src/org/apache/cocoon/generation/JXFormsGenerator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- JXFormsGenerator.java 27 Apr 2003 22:13:36 -0000 1.4
+++ JXFormsGenerator.java 30 Apr 2003 09:39:01 -0000 1.5
@@ -71,6 +71,7 @@
import org.apache.commons.jxpath.JXPathContext;
import org.apache.commons.jxpath.JXPathContextFactory;
import org.apache.commons.jxpath.Pointer;
+import org.apache.commons.jxpath.ri.model.NodePointer;
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceException;
import org.xml.sax.Attributes;
@@ -175,16 +176,79 @@
final static String PHASE = "phase";
+ static class XPathExpr {
+
+ final CompiledExpression jxpath;
+ final String string;
+ final boolean absolute;
+
+ XPathExpr(String string, CompiledExpression jxpath,
+ boolean absolute) {
+ this.string = string;
+ this.jxpath = jxpath;
+ this.absolute = absolute;
+ }
+
+ Object getValue(JXPathContext root, JXPathContext current) {
+ JXPathContext ctx = current;
+ if (absolute) {
+ ctx = root;
+ }
+ return jxpath.getValue(ctx);
+ }
+
+ Object getNode(JXPathContext root, JXPathContext current) {
+ JXPathContext ctx = current;
+ if (absolute) {
+ ctx = root;
+ }
+ Pointer ptr = jxpath.getPointer(ctx, "???");
+ if (ptr == null) {
+ return null;
+ }
+ return ptr.getNode();
+ }
+
+ Iterator iteratePointers(JXPathContext root, JXPathContext current) {
+ JXPathContext ctx = current;
+ if (absolute) {
+ ctx = root;
+ }
+ // hack: for non-collections iteratePointers doesn't always do
+ // the right thing
+ final NodePointer ptr = (NodePointer)jxpath.getPointer(ctx,
"???");
+ if (ptr.isCollection()) {
+ return jxpath.iteratePointers(ctx);
+ }
+ return new Iterator() {
+ Pointer p = ptr;
+ public boolean hasNext() {
+ return p != null;
+ }
+ public Object next() {
+ Object result = p;
+ p = null;
+ return result;
+ }
+ public void remove() {
+ }
+ };
+ }
+ }
+
+
/**
* Compile a single XPath expression
*/
- static private CompiledExpression
+ static private XPathExpr
compileExpr(String expr, Locator location)
throws SAXParseException {
if (expr == null) return null;
+ expr = expr.trim();
try {
- return JXPathContext.compile(expr);
+ CompiledExpression jxpath = JXPathContext.compile(expr);
+ return new XPathExpr(expr, jxpath, expr.startsWith("/"));
} catch (Exception exc) {
throw new SAXParseException(exc.getMessage(),
location, exc);
@@ -414,14 +478,15 @@
static class StartInputControl extends Event {
StartInputControl(Locator location,
- CompiledExpression ref,
+ XPathExpr ref,
StartElement startElement)
throws SAXException {
super(location);
this.ref = ref;
this.startElement = startElement;
}
- final CompiledExpression ref;
+ final XPathExpr ref;
+ boolean absolute;
final StartElement startElement;
EndInputControl endInputControl;
}
@@ -439,14 +504,14 @@
static class StartReadonlyInputControl extends Event {
StartReadonlyInputControl(Locator location,
- CompiledExpression ref,
+ XPathExpr ref,
StartElement startElement)
throws SAXException {
super(location);
this.ref = ref;
this.startElement = startElement;
}
- final CompiledExpression ref;
+ final XPathExpr ref;
final StartElement startElement;
EndReadonlyInputControl endReadonlyInputControl;
}
@@ -510,7 +575,7 @@
static class StartRepeat extends Event {
StartRepeat(Locator location, String namespaceURI,
String localName, String raw,
- Attributes attrs, CompiledExpression nodeset)
+ Attributes attrs, XPathExpr nodeset)
throws SAXException {
super(location);
this.startElement = new StartElement(location,
@@ -520,7 +585,7 @@
attrs);
this.nodeset = nodeset;
}
- final CompiledExpression nodeset;
+ final XPathExpr nodeset;
final StartElement startElement;
EndRepeat endRepeat;
}
@@ -534,7 +599,7 @@
static class StartItemSet extends Event {
StartItemSet(Locator location, String namespaceURI,
String localName, String raw,
- Attributes attrs, CompiledExpression nodeset)
+ Attributes attrs, XPathExpr nodeset)
throws SAXException {
super(location);
this.startElement = new StartElement(location,
@@ -544,7 +609,7 @@
attrs);
this.nodeset = nodeset;
}
- final CompiledExpression nodeset;
+ final XPathExpr nodeset;
final StartElement startElement;
EndItemSet endItemSet;
}
@@ -653,16 +718,16 @@
static class StartOutput extends Event {
StartOutput(Locator location,
- CompiledExpression ref,
- CompiledExpression value,
+ XPathExpr ref,
+ XPathExpr value,
StartElement startElement) {
super(location);
this.startElement = startElement;
this.ref = ref;
this.value = value;
}
- final CompiledExpression ref;
- final CompiledExpression value;
+ final XPathExpr ref;
+ final XPathExpr value;
final StartElement startElement;
EndOutput endOutput;
}
@@ -678,13 +743,13 @@
static class StartGroup extends Event {
StartGroup(Locator location,
- CompiledExpression ref,
+ XPathExpr ref,
StartElement startElement) {
super(location);
this.ref = ref;
this.startElement = startElement;
}
- final CompiledExpression ref;
+ final XPathExpr ref;
final StartElement startElement;
EndGroup endGroup;
}
@@ -700,13 +765,13 @@
static class StartHidden extends Event {
StartHidden(Locator location,
- CompiledExpression ref,
+ XPathExpr ref,
StartElement startElement) {
super(location);
this.ref = ref;
this.startElement = startElement;
}
- final CompiledExpression ref;
+ final XPathExpr ref;
final StartElement startElement;
EndHidden endHidden;
}
@@ -899,7 +964,7 @@
if (NS.equals(namespaceURI)) {
if (localName.equals(REPEAT)) {
String items = attrs.getValue(NODESET);
- CompiledExpression expr =
+ XPathExpr expr =
compileExpr(items, locator);
StartRepeat startRepeat =
new StartRepeat(locator, namespaceURI,
@@ -907,7 +972,7 @@
newEvent = startRepeat;
} else if (localName.equals(ITEMSET)) {
String items = attrs.getValue(NODESET);
- CompiledExpression expr =
+ XPathExpr expr =
compileExpr(items, locator);
StartItemSet startItemSet =
new StartItemSet(locator, namespaceURI,
@@ -915,7 +980,7 @@
newEvent = startItemSet;
} else if (isReadonlyInputControl(localName)) {
String refStr = attrs.getValue("ref");
- CompiledExpression ref =
+ XPathExpr ref =
compileExpr(refStr, locator);
StartReadonlyInputControl startInputControl =
new StartReadonlyInputControl(locator,
@@ -925,7 +990,7 @@
newEvent = startInputControl;
} else if (isInputControl(localName)) {
String refStr = attrs.getValue("ref");
- CompiledExpression ref =
+ XPathExpr ref =
compileExpr(refStr, locator);
StartInputControl startInputControl =
new StartInputControl(locator,
@@ -959,9 +1024,9 @@
if (refStr != null && valueStr != null) {
throw new SAXParseException("ref and value are
mutually exclusive", locator, null);
}
- CompiledExpression ref = compileExpr(refStr,
+ XPathExpr ref = compileExpr(refStr,
locator);
- CompiledExpression value = compileExpr(valueStr,
+ XPathExpr value = compileExpr(valueStr,
locator);
StartOutput startOutput =
new StartOutput(locator,
@@ -981,7 +1046,7 @@
newEvent = startViolations;
} else if (GROUP.equals(localName)) {
String refStr = attrs.getValue(REF);
- CompiledExpression ref =
+ XPathExpr ref =
compileExpr(refStr, locator);
StartGroup startGroup =
new StartGroup(locator,
@@ -990,7 +1055,7 @@
newEvent = startGroup;
} else if (HIDDEN.equals(localName)) {
String refStr = attrs.getValue(REF);
- CompiledExpression ref =
+ XPathExpr ref =
compileExpr(refStr, locator);
StartHidden startHidden =
new StartHidden(locator,
@@ -1067,11 +1132,14 @@
public void endDocument() throws SAXException {
super.endDocument();
+ JXPathContext ctx =
+ jxpathContextFactory.newContext(null, null);
template.execute(template.getConsumer(),
null, // form
null, // view
null, // contextPath
- jxpathContextFactory.newContext(null, null),
+ ctx, // root context
+ ctx, // current context
getStartEvent(),
null);
}
@@ -1169,11 +1237,13 @@
cache.put(inputSource.getURI(), startEvent);
}
}
+ JXPathContext ctx = jxpathContextFactory.newContext(null, null);
execute(consumer,
null, // form
null, // view
null, // contextPath
- jxpathContextFactory.newContext(null, null),
+ ctx,
+ ctx,
startEvent,
null);
}
@@ -1182,7 +1252,8 @@
Form form,
String currentView,
String contextPath,
- JXPathContext jxpathContext,
+ JXPathContext rootContext,
+ JXPathContext currentContext,
Event startEvent, Event endEvent)
throws SAXException {
Event ev = startEvent;
@@ -1254,14 +1325,15 @@
} else if (ev instanceof StartRepeat) {
StartRepeat startRepeat = (StartRepeat)ev;
- final CompiledExpression nodeset = startRepeat.nodeset;
+ final XPathExpr nodeset = startRepeat.nodeset;
Iterator iter = null;
try {
if (nodeset == null) {
iter = NULL_ITER;
} else {
iter =
- nodeset.iteratePointers(jxpathContext);
+ nodeset.iteratePointers(rootContext,
+ currentContext);
}
} catch (Exception exc) {
throw new SAXParseException(exc.getMessage(),
@@ -1293,6 +1365,7 @@
form,
currentView,
path,
+ rootContext,
localJXPathContext,
startRepeat.next,
startRepeat.endRepeat);
@@ -1306,11 +1379,11 @@
startElement.localName,
startElement.raw,
startElement.attributes);
- final CompiledExpression ref = startGroup.ref;
+ final XPathExpr ref = startGroup.ref;
if (ref != null) {
Object value;
try {
- value = ref.getValue(jxpathContext);
+ value = ref.getNode(rootContext, currentContext);
} catch (Exception exc) {
throw new SAXParseException(exc.getMessage(),
ev.location,
@@ -1327,6 +1400,7 @@
form,
currentView,
path,
+ rootContext,
localJXPathContext,
startGroup.next,
startGroup.endGroup);
@@ -1335,14 +1409,15 @@
}
} else if (ev instanceof StartItemSet) {
StartItemSet startItemSet = (StartItemSet)ev;
- final CompiledExpression nodeset = startItemSet.nodeset;
+ final XPathExpr nodeset = startItemSet.nodeset;
Iterator iter = null;
try {
if (nodeset == null) {
iter = NULL_ITER;
} else {
iter =
- nodeset.iteratePointers(jxpathContext);
+ nodeset.iteratePointers(rootContext,
+ currentContext);
}
} catch (Exception exc) {
throw new SAXParseException(exc.getMessage(),
@@ -1379,6 +1454,7 @@
form,
currentView,
ptr.asPath(),
+ rootContext,
localJXPathContext,
startItemSet.next,
startItemSet.endItemSet);
@@ -1392,22 +1468,23 @@
//
StartInputControl startInputControl =
(StartInputControl)ev;
- CompiledExpression ref = startInputControl.ref;
+ XPathExpr ref = startInputControl.ref;
StartElement startElement = startInputControl.startElement;
- String refStr = startElement.attributes.getValue("ref");
consumer.startElement(startElement.namespaceURI,
startElement.localName,
startElement.raw,
startElement.attributes);
if (ref != null) {
- Iterator iter = ref.iteratePointers(jxpathContext);
+ Iterator iter = ref.iteratePointers(rootContext,
+ currentContext);
while (iter.hasNext()) {
Pointer ptr = (Pointer)iter.next();
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute(NS, REF, REF, "CDATA",
ptr.asPath());
consumer.startElement(NS, VALUE, VALUE, EMPTY_ATTRS);
- Object val = ptr.getNode();
+ Object val = ptr.getValue();
+ if (val == null) val = "";
String str = String.valueOf(val);
consumer.characters(str.toCharArray(), 0,
str.length());
consumer.endElement(NS, VALUE, VALUE);
@@ -1432,7 +1509,8 @@
Object refValue = null;
if (startReadonlyInputControl.ref != null) {
refValue =
-
startReadonlyInputControl.ref.getValue(jxpathContext);
+ startReadonlyInputControl.ref.getValue(rootContext,
+
currentContext);
}
consumer.startElement(startElement.namespaceURI,
startElement.localName,
@@ -1460,9 +1538,11 @@
startElement.localName,
startElement.raw,
startElement.attributes);
+ rootContext =
+ jxpathContextFactory.newContext(null,
+ newForm.getModel());
execute(consumer, newForm, view, contextPath,
- jxpathContextFactory.newContext(null,
- newForm.getModel()),
+ rootContext, rootContext,
startForm.next, startForm.endForm);
consumer.endElement(startElement.namespaceURI,
startElement.localName,
@@ -1575,7 +1655,8 @@
} else if (ev instanceof StartOutput) {
StartOutput startOutput = (StartOutput)ev;
StartElement startElement = startOutput.startElement;
- JXPathContext ctx = jxpathContext;
+ JXPathContext rootCtx = rootContext;
+ JXPathContext ctx = currentContext;
String formId = startElement.attributes.getValue(FORM);
if (formId != null) {
Form theForm = Form.lookup(objectModel, formId);
@@ -1584,8 +1665,10 @@
ev.location,
null);
}
- ctx = jxpathContextFactory.newContext(null,
-
theForm.getModel());
+ rootCtx =
+ ctx =
+ jxpathContextFactory.newContext(null,
+ theForm.getModel());
}
consumer.startElement(startElement.namespaceURI,
startElement.localName,
@@ -1593,9 +1676,9 @@
startElement.attributes);
Object val = null;
if (startOutput.ref != null) {
- val = startOutput.ref.getValue(ctx);
+ val = startOutput.ref.getValue(rootCtx, ctx);
} else if (startOutput.value != null) {
- val = startOutput.value.getValue(ctx);
+ val = startOutput.value.getValue(rootCtx, ctx);
}
if (val != null) {
consumer.startElement(NS, VALUE, VALUE, EMPTY_ATTRS);
@@ -1632,10 +1715,12 @@
if (startViolations.parent instanceof StartInputControl) {
StartInputControl control =
(StartInputControl)startViolations.parent;
- mypath = control.startElement.attributes.getValue(REF);
- if (contextPath != null) {
- if (!mypath.startsWith("/")) {
- mypath = contextPath + "/" + mypath;
+ if (control.ref != null) {
+ mypath = control.ref.string;
+ if (contextPath != null) {
+ if (!control.ref.absolute) {
+ mypath = contextPath + "/" + mypath;
+ }
}
}
}
1.17 +155 -152
cocoon-2.1/src/scratchpad/webapp/samples/petstore/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/scratchpad/webapp/samples/petstore/sitemap.xmap,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- sitemap.xmap 26 Apr 2003 22:01:36 -0000 1.16
+++ sitemap.xmap 30 Apr 2003 09:39:01 -0000 1.17
@@ -1,152 +1,155 @@
-<?xml version="1.0"?>
-<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
-
- <!-- =========================== Components
================================ -->
- <map:components>
- <map:transformers default="xslt">
- <map:transformer name="xmlform"
src="org.apache.cocoon.transformation.XMLFormTransformer"
logger="xmlform.sitemap.transformer"/>
- <map:transformer name="jx"
src="org.apache.cocoon.transformation.JXTemplateTransformer"
logger="jx.sitemap.transformer"/>
- </map:transformers>
- <map:generators default="file">
- <map:generator label="content,data"
logger="sitemap.generator.velocity" name="velocity"
src="org.apache.cocoon.generation.FlowVelocityGenerator"/>
- <map:generator label="content,data" logger="sitemap.generator.jx"
name="jx" src="org.apache.cocoon.generation.JXTemplateGenerator"/>
- </map:generators>
- <map:flow-interpreters default="JavaScript"/>
- <map:serializers default="html"/>
- <map:matchers default="wildcard"/>
- </map:components>
-
-
-<!-- =========================== Views ===================================
-->
-
-<!--
- The debug view can be used to output an intermediate
- snapshot of the pipeline.
- Pass cocoon-view=debug as a URL parameter to see
- the pipeline output produced by the transofrmer
- labeled "debug". You can move the label to different
- transformers to understand each processing
- stage better.
--->
-<map:views>
- <map:view name="debug" from-label="debug">
- <map:serialize type="xml"/>
- </map:view>
- <map:view name="debug1" from-label="debug1">
- <map:serialize type="xml"/>
- </map:view>
- <map:view name="debug2" from-label="debug2">
- <map:serialize type="xml"/>
- </map:view>
- <map:view name="xml" from-label="xml">
- <map:serialize type="xml"/>
- </map:view>
-</map:views>
-
- <!-- =========================== Resources
================================= -->
-
- <map:resources>
- </map:resources>
-
- <!-- =========================== Pipelines
================================= -->
- <map:flow language="JavaScript">
- <map:script src="flow/PetStoreImpl.js"/>
- <map:script src="flow/petstore.js"/>
- </map:flow>
- <map:pipelines>
-
- <map:pipeline>
- <map:match pattern="*.kont">
- <map:call continuation="{1}"/> <!--
- This handles sendPage*() continuations.
- -->
- </map:match>
- <map:match pattern="*.do">
- <map:call function="main">
- <map:parameter name="page" value="{1}"/>
- </map:call>
- </map:match>
- <map:match pattern="petstore">
- <map:call function="xmlForm"/> <!--
- Without parameters xmlForm() handles XMLForm continuations:
- The pattern I'm matching here, "petstore", must match the value
- of the "action" attribute in the view's <xf:submit> elements
- -->
- </map:match>
- <map:match pattern="">
- <map:call function="index"/>
- </map:match>
- <map:match pattern="editAccount.form">
- <map:call function="xmlForm">
- <map:parameter name="xmlform-function" value="editAccountForm"/>
- <map:parameter name="xmlform-id" value="petstore-edit-account"/> <!--
- The value I supply here, "petstore-edit-account", must
match
- the "id" attribute of the view's <xf:form> element
- -->
- <map:parameter name="xmlform-validator-schema-ns"/> <!-- no
validator -->
- <map:parameter name="xmlform-validator-schema"/> <!-- no validator
-->
- <map:parameter name="xmlform-scope" value="session"/>
- </map:call>
- </map:match>
-
- <map:match pattern="view/xmlform/*.xml">
- <!-- original XMLForm document -->
- <map:generate src="view/xmlform/{1}.xml"/>
-
- <!-- populating the document with model instance data -->
-
- <map:transform type="xmlform" label="debug"/>
- <map:transform type="xalan" src="stylesheets/site2html.xsl"
label="debug1"/>
- <map:serialize type="html" />
- </map:match>
- </map:pipeline>
- <map:pipeline>
- <map:match pattern="view/*.xsp">
- <map:generate src="view/xsp/{1}.xsp" type="serverpages"/>
- <map:transform src="stylesheets/site2html.xsl" />
- <map:serialize type="html"/>
- </map:match>
- <map:match pattern="view/Cart.jxpath">
- <map:generate src="view/jxpath/Cart.xml" type="jx" />
- <map:serialize type="html"/>
- </map:match>
- <map:match pattern="view/*.jxpath">
- <map:generate src="view/jxpath/{1}.xml" type="file" />
- <map:transform type="jx" />
- <map:transform src="stylesheets/site2html.xsl" />
- <map:serialize type="html"/>
- </map:match>
- <map:match pattern="view/Cart.jexl">
- <map:generate src="view/jexl/Cart.xml" type="jx" />
- <map:serialize type="html"/>
- </map:match>
- <map:match pattern="view/*.jexl">
- <map:generate src="view/jexl/{1}.xml" type="jx" />
- <map:transform src="stylesheets/site2html.xsl" />
- <map:serialize type="html"/>
- </map:match>
- <map:match pattern="view/*.vm">
- <map:generate src="view/templates/{1}.vm" type="velocity"/>
- <map:serialize type="html"/>
- </map:match>
- </map:pipeline>
-
- <map:pipeline>
- <map:match pattern="images/*.gif">
- <map:read mime-type="images/gif" src="images/{1}.gif"/>
- </map:match>
- </map:pipeline>
-
-
- </map:pipelines>
-
-</map:sitemap>
-<!-- end of file -->
-
-
-
-
-
-
-
-
+<?xml version="1.0"?>
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+ <!-- =========================== Components
================================ -->
+ <map:components>
+ <map:transformers default="xslt">
+ <map:transformer name="jx"
src="org.apache.cocoon.transformation.JXTemplateTransformer"
logger="jx.sitemap.transformer"/>
+ </map:transformers>
+ <map:generators default="file">
+ <map:generator label="content,data"
logger="sitemap.generator.velocity" name="velocity"
src="org.apache.cocoon.generation.FlowVelocityGenerator"/>
+ <map:generator label="content,data" logger="sitemap.generator.jx"
name="jx" src="org.apache.cocoon.generation.JXTemplateGenerator"/>
+ <map:generator name="jxforms"
src="org.apache.cocoon.generation.JXFormsGenerator"
logger="sitemap.generator.jxforms"/>
+ </map:generators>
+ <map:flow-interpreters default="JavaScript"/>
+ <map:serializers default="html"/>
+ <map:matchers default="wildcard"/>
+ </map:components>
+
+
+<!-- =========================== Views ===================================
-->
+
+<!--
+ The debug view can be used to output an intermediate
+ snapshot of the pipeline.
+ Pass cocoon-view=debug as a URL parameter to see
+ the pipeline output produced by the transofrmer
+ labeled "debug". You can move the label to different
+ transformers to understand each processing
+ stage better.
+-->
+<map:views>
+ <map:view name="debug" from-label="debug">
+ <map:serialize type="xml"/>
+ </map:view>
+ <map:view name="debug1" from-label="debug1">
+ <map:serialize type="xml"/>
+ </map:view>
+ <map:view name="debug2" from-label="debug2">
+ <map:serialize type="xml"/>
+ </map:view>
+ <map:view name="xml" from-label="xml">
+ <map:serialize type="xml"/>
+ </map:view>
+</map:views>
+
+ <!-- =========================== Resources
================================= -->
+
+ <map:resources>
+ </map:resources>
+
+ <!-- =========================== Pipelines
================================= -->
+ <map:flow language="JavaScript">
+ <map:script src="flow/PetStoreImpl.js"/>
+ <map:script src="flow/petstore.js"/>
+ </map:flow>
+ <map:pipelines>
+
+ <map:pipeline>
+ <map:match pattern="*.kont">
+ <map:call continuation="{1}"/> <!--
+ This handles sendPage*() continuations.
+ -->
+ </map:match>
+ <map:match pattern="*.do">
+ <map:call function="main">
+ <map:parameter name="page" value="{1}"/>
+ </map:call>
+ </map:match>
+ <map:match pattern="petstore">
+ <map:call function="jxForm"/> <!--
+ Without parameters jxForm() handles continuations:
+ The pattern I'm matching here, "petstore", must match the value
+ of the "action" attribute in the view's <xf:submit> element
+ -->
+ </map:match>
+ <map:match pattern="">
+ <map:call function="index"/>
+ </map:match>
+ <map:match pattern="editAccount.form">
+ <map:call function="jxForm">
+ <map:parameter name="function" value="editAccountForm"/>
+ <map:parameter name="id" value="petstore-edit-account"/> <!--
+ The value I supply here, "petstore-edit-account", must
match
+ the "id" attribute of the view's <xf:form> element
+ -->
+ <map:parameter name="validator-schema-ns"/> <!-- no validator -->
+ <map:parameter name="validator-schema"/> <!-- no validator -->
+ <map:parameter name="scope" value="request"/>
+ </map:call>
+ </map:match>
+
+ <map:match pattern="view/jxforms/*.xml">
+ <!-- original JXForms document -->
+ <map:generate type="jxforms" src="view/jxforms/{1}.xml"/>
+
+ <map:transform type="xalan" src="stylesheets/form2html.xsl"
label="debug1"/>
+
+ <map:transform type="xalan"
src="../jxforms/stylesheets/jxforms2html.xsl" />
+
+
+ <map:transform type="xalan" src="stylesheets/site2html.xsl"
label="debug1"/>
+
+ <map:serialize type="html" />
+ </map:match>
+ </map:pipeline>
+ <map:pipeline>
+ <map:match pattern="view/*.xsp">
+ <map:generate src="view/xsp/{1}.xsp" type="serverpages"/>
+ <map:transform src="stylesheets/site2html.xsl" />
+ <map:serialize type="html"/>
+ </map:match>
+ <map:match pattern="view/Cart.jxpath">
+ <map:generate src="view/jxpath/Cart.xml" type="jx" />
+ <map:serialize type="html"/>
+ </map:match>
+ <map:match pattern="view/*.jxpath">
+ <map:generate src="view/jxpath/{1}.xml" type="file" />
+ <map:transform type="jx" />
+ <map:transform src="stylesheets/site2html.xsl" />
+ <map:serialize type="html"/>
+ </map:match>
+ <map:match pattern="view/Cart.jexl">
+ <map:generate src="view/jexl/Cart.xml" type="jx" />
+ <map:serialize type="html"/>
+ </map:match>
+ <map:match pattern="view/*.jexl">
+ <map:generate src="view/jexl/{1}.xml" type="jx" />
+ <map:transform src="stylesheets/site2html.xsl" />
+ <map:serialize type="html"/>
+ </map:match>
+ <map:match pattern="view/*.vm">
+ <map:generate src="view/templates/{1}.vm" type="velocity"/>
+ <map:serialize type="html"/>
+ </map:match>
+ </map:pipeline>
+
+ <map:pipeline>
+ <map:match pattern="images/*.gif">
+ <map:read mime-type="images/gif" src="images/{1}.gif"/>
+ </map:match>
+ </map:pipeline>
+
+
+ </map:pipelines>
+
+</map:sitemap>
+<!-- end of file -->
+
+
+
+
+
+
+
+
1.12 +11 -8
cocoon-2.1/src/scratchpad/webapp/samples/petstore/flow/petstore.js
Index: petstore.js
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/scratchpad/webapp/samples/petstore/flow/petstore.js,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- petstore.js 13 Apr 2003 22:20:12 -0000 1.11
+++ petstore.js 30 Apr 2003 09:39:01 -0000 1.12
@@ -46,8 +46,8 @@
// Page Flow for PetStore Application
-// load xml form support
-cocoon.load("resource://org/apache/cocoon/components/flow/javascript/xmlForm.js");
+// load JXForm support
+cocoon.load("resource://org/apache/cocoon/components/jxforms/flow/jxForm.js");
var MAX_RESULTS = 5;
@@ -376,19 +376,20 @@
password: "",
password2: ""};
form.setModel(model);
- form.sendView("editAccountForm",
- "view/xmlform/EditAccountForm.xml",
+ form.sendView("view/jxforms/EditUserInformation.xml",
function(form) {
- for (var i in model.account) {
- print(i+"="+model.account[i]);
- }
if (model.userName == "") {
form.addViolation("/userName", "User ID is required");
} else {
- if (model.password != model.password2) {
+ if (model.password == null || model.password.length == 0) {
+ form.addViolation("/password", "Password is required");
+ } else if (model.password != model.password2) {
form.addViolation("/password2", "Passwords don't match");
}
}
+ });
+ form.sendView("view/jxforms/EditAccountInformation.xml",
+ function(form) {
if (account.firstName == "") {
form.addViolation("/account/firstName", "First name is
required");
}
@@ -405,6 +406,8 @@
}
});
+ form.sendView("view/jxforms/EditProfileInformation.xml");
+ form.finish();
index();
}
1.3 +120 -159
cocoon-2.1/src/scratchpad/webapp/samples/petstore/stylesheets/form2html.xsl
Index: form2html.xsl
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/scratchpad/webapp/samples/petstore/stylesheets/form2html.xsl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- form2html.xsl 25 Mar 2003 20:55:09 -0000 1.2
+++ form2html.xsl 30 Apr 2003 09:39:02 -0000 1.3
@@ -1,159 +1,120 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Cocoon Feedback Wizard XMLForm processing and displaying stylesheet.
-
- This stylesheet merges an XMLForm document into
- a final document. It includes other presentational
- parts of a page orthogonal to the xmlform.
-
- author: Ivelin Ivanov, [EMAIL PROTECTED], May 2002
- author: Konstantin Piroumian <[EMAIL PROTECTED]>, September 2002
- author: Simon Price <[EMAIL PROTECTED]>, September 2002
-
--->
-<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xf="http://xml.apache.org/cocoon/xmlform/2002"
- exclude-result-prefixes="xalan" >
- <xsl:template match="document">
- <html>
- <head>
- <title></title>
-
- </head>
- <body>
- <xsl:apply-templates />
- </body>
- </html>
- </xsl:template>
- <xsl:template match="xf:form">
- <xf:form method="post">
- <xsl:copy-of select="@*" />
- <br/>
- <br/>
- <br/>
- <br/>
- <table align="center" border="0">
- <tr>
- <td align="center" colspan="3">
- <h1>
- <xsl:value-of
select="xf:caption"/>
- <hr/>
- </h1>
- </td>
- </tr>
- <xsl:if test="count(error/xf:violation) > 0">
- <tr>
- <td align="left" colspan="3"
-
class="{error/xf:violation[1]/@class}">
- <p>* The information
you submitted contains [<b><xsl:value-of
-
select="count(error/xf:violation)"/></b>]
- error(s).
Please fix the specified error(s) and submit the
- form again.</p>
- <p>
- <xsl:variable
name="localViolations"
-
select=".//xf:*[ child::xf:violation ]"/>
- <xsl:for-each
select="error/xf:violation">
-
<xsl:variable name="eref" select="./@ref"/>
- <xsl:if
-
test="count ($localViolations[ @ref=$eref ]) = 0"
-
>* <xsl:value-of select="." /> <br/> </xsl:if>
- </xsl:for-each>
- </p>
- <p/>
- </td>
- </tr>
- </xsl:if>
- <xsl:for-each select="*[name() != 'xf:submit']">
- <xsl:choose>
- <xsl:when test="name() =
'error'"/>
- <xsl:when test="name() =
'xf:caption'"/>
- <xsl:when test="xf:*">
- <xsl:apply-templates
select="."/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of
select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- <tr>
- <td align="center" colspan="3">
- <xsl:for-each select="*[name()
= 'xf:submit']">
- <xsl:copy-of select="."
/>
- <xsl:text>
- </xsl:text>
- </xsl:for-each>
- </td>
- </tr>
- </table>
- </xf:form>
- </xsl:template>
- <xsl:template match="xf:repeat">
- <tr width="100%">
- <td colspan="3" width="100%">
- <table class="repeat">
- <xsl:apply-templates select="*"/>
- </table>
- </td>
- </tr>
- </xsl:template>
- <xsl:template match="xf:group">
- <tr width="100%">
- <td width="100%" colspan="2">
- <table class="group" border="0">
- <tr>
- <td align="left">
- <xsl:value-of
select="xf:caption" />
- </td>
- </tr>
- <xsl:apply-templates select="*"/>
- </table>
- </td>
- </tr>
- </xsl:template>
- <xsl:template match="xf:[EMAIL PROTECTED]">
- <div align="center">
- <hr width="30%"/>
- <br/>
- <font size="-1">
- <code> <xsl:value-of select="xf:caption" /> :
<xsl:copy-of
- select="." /> </code>
- </font>
- <br/>
- </div>
- </xsl:template>
- <xsl:template match="xf:caption"/>
- <xsl:template match="xf:*">
- <tr>
- <td align="left" valign="top">
- <p class="caption">
- <xsl:value-of select="xf:caption" />
- </p>
- </td>
- <td align="left">
- <table class="plaintable">
- <tr>
- <td align="left">
- <xsl:copy-of select="."
/>
- </td>
- <xsl:if test="xf:violation">
- <td align="left"
class="{xf:violation[1]/@class}"
- width="100%">
- <xsl:for-each
select="xf:violation">*
-
<xsl:value-of select="." /> <br/> </xsl:for-each>
- </td>
- </xsl:if>
- </tr>
- </table>
- <xsl:if test="xf:help">
- <div class="help">
- <xsl:value-of select="xf:help"
/>
- </div>
- <br />
- </xsl:if>
- </td>
- </tr>
- </xsl:template>
- <xsl:template match="*">
- <xsl:copy-of select="." />
- </xsl:template>
-</xsl:stylesheet>
+<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xf="http://cocoon.apache.org/jxforms/2002/cr"
+ exclude-result-prefixes="xalan" >
+
+ <xsl:template match="/">
+ <xsl:apply-templates />
+ </xsl:template>
+
+ <xsl:template match="xf:form">
+ <xf:form method="post">
+ <xsl:copy-of select="@*" />
+ <table cellpadding="10" cellspacing="0" border="1"
align="center" bgcolor="#dddddd">
+ <xsl:if test="count(error/xf:violation) > 0">
+ <tr>
+ <td align="left" colspan="3"
+
class="{error/xf:violation[1]/@class}">
+ <p>* [<b><xsl:value-of
+
select="count(error/xf:violation)"/></b>]
+ error(s).
Please fix these errors and submit the
+ form again.</p>
+ <p>
+ <xsl:variable
name="localViolations"
+
select=".//xf:*[ child::xf:violation ]"/>
+ <xsl:for-each
select="error/xf:violation">
+
<xsl:variable name="eref" select="./@ref"/>
+ <xsl:if
+
test="count ($localViolations[ @ref=$eref ]) = 0"
+
>* <xsl:value-of select="." /> <br/> </xsl:if>
+ </xsl:for-each>
+ </p>
+ <p/>
+ </td>
+ </tr>
+ </xsl:if>
+ <xsl:for-each select="*[name() != 'xf:submit']">
+ <xsl:choose>
+ <xsl:when test="name() =
'error'"/>
+ <xsl:when test="name() =
'xf:label'"/>
+ <xsl:when test="xf:*">
+ <xsl:apply-templates
select="."/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of
select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ <tr>
+ <td align="center" colspan="3">
+ <xsl:for-each select="*[name()
= 'xf:submit']">
+ <xsl:copy-of select="."
/>
+ <xsl:text>
+ </xsl:text>
+ </xsl:for-each>
+ </td>
+ </tr>
+ </table>
+ </xf:form>
+ </xsl:template>
+ <xsl:template match="xf:group">
+ <tr>
+ <td>
+ <font color="darkgreen"><h3><xsl:value-of
select="xf:label" /></h3></font>
+ <table cellspacing="1" cellpadding="3"
border="0" bgcolor="#008800">
+ <xsl:apply-templates select="*"/>
+ </table>
+ </td>
+ </tr>
+ </xsl:template>
+ <xsl:template match="xf:[EMAIL PROTECTED]">
+ <div align="center">
+ <hr width="30%"/>
+ <br/>
+ <font size="-1">
+ <code> <xsl:value-of select="xf:label" /> :
<xsl:copy-of
+ select="." /> </code>
+ </font>
+ <br/>
+ </div>
+ </xsl:template>
+ <xsl:template match="xf:label"/>
+ <xsl:template match="xf:*">
+ <tr bgcolor="#FFFF88">
+ <td align="left" valign="top">
+ <p class="label">
+ <xsl:value-of select="xf:label" />
+ </p>
+ </td>
+ <td align="left">
+ <table class="plaintable">
+ <tr bgcolor="#FFFF88">
+ <td align="left">
+ <xsl:copy-of select="."
/>
+ </td>
+ <xsl:if test="xf:violation">
+ <td align="left"
class="{xf:violation[1]/@class}" width="100%">
+ <xsl:for-each
select="xf:violation">*
+
<xsl:value-of select="." /> <br/> </xsl:for-each>
+ </td>
+ </xsl:if>
+ </tr>
+ </table>
+ <xsl:if test="xf:help">
+ <div class="help">
+ <xsl:value-of select="xf:help"
/>
+ </div>
+ <br />
+ </xsl:if>
+ </td>
+ </tr>
+ </xsl:template>
+ <!-- copy all the rest of the markup which is not recognized above -->
+ <xsl:template match="*">
+ <xsl:copy><xsl:copy-of select="@*" /><xsl:apply-templates /></xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="text()">
+ <xsl:value-of select="." />
+ </xsl:template>
+
+</xsl:stylesheet>
1.8 +602 -723
cocoon-2.1/src/scratchpad/webapp/samples/petstore/stylesheets/site2html.xsl
Index: site2html.xsl
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/scratchpad/webapp/samples/petstore/stylesheets/site2html.xsl,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- site2html.xsl 27 Mar 2003 18:59:22 -0000 1.7
+++ site2html.xsl 30 Apr 2003 09:39:02 -0000 1.8
@@ -1,723 +1,602 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-
-<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xf="http://xml.apache.org/cocoon/xmlform/2002"
- exclude-result-prefixes="xalan" >
-
- <xsl:template match="site">
- <html>
- <head>
- <meta content="text/html; charset=windows-1252"
http-equiv="Content-Type" />
- <meta HTTP-EQUIV="Cache-Control"
CONTENT="max-age=0"/>
- <meta HTTP-EQUIV="Cache-Control"
CONTENT="no-cache"/>
- <meta http-equiv="expires" content="0"/>
- <meta HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan
1980 1:00:00 GMT"/>
- <meta HTTP-EQUIV="Pragma" CONTENT="no-cache"/>
- </head>
- <body bgcolor="white">
- <table background="images/bkg-topbar.gif"
border="0" cellspacing="0" cellpadding="5" width="100%">
- <tbody>
- <tr>
- <td>
- <form method="post"
action="index.do">
- <input
type="image" border="0" src="images/logo-topbar.gif" />
- <select
name="view" width="14" align="left" onChange="document.forms[0].submit()">
- <xsl:choose>
-
<xsl:when test="@view='jxpath'">
-
<option value="JXPath">JXPath</option>
-
<option value="Jexl">Jexl</option>
-
<option value="Xsp">Xsp</option>
-
<option value="Velocity">Velocity</option>
-
</xsl:when>
-
<xsl:when test="@view='jexl'">
-
<option value="Jexl">Jexl</option>
-
<option value="JXPath">JXPath</option>
-
<option value="Xsp">Xsp</option>
-
<option value="Velocity">Velocity</option>
-
</xsl:when>
-
<xsl:otherwise>
-
<option value="Xsp">Xsp</option>
-
<option value="JXPath">JXPath</option>
-
<option value="Jexl">Jexl</option>
-
<option value="Velocity">Velocity</option>
-
</xsl:otherwise>
-
</xsl:choose>
- </select>
- </form>
- </td>
- <td align="right">
- <a
href="viewCart.do"><img border="0" name="img_cart" src="images/cart.gif"
/></a><img border="0" src="images/separator.gif" hspace="4" />
- <xsl:choose>
-
<xsl:when test="@signOn='true'">
-
<a href="signonForm.do"><img border="0" name="img_signin"
src="images/sign-in.gif" /></a>
-
</xsl:when>
-
<xsl:otherwise>
-
<a href="signonForm.do?signoff=true"><img border="0" name="img_signout"
src="images/sign-out.gif" /></a><img border="0" src="images/separator.gif"
hspace="4" />
-
<a href="editAccount.form"><img border="0" name="img_myaccount"
src="images/my_account.gif" /></a>
-
</xsl:otherwise>
- </xsl:choose>
- <img border="0"
src="images/separator.gif" hspace="4" /><a href="../help.html"><img border="0"
name="img_help" src="images/help.gif" /></a>
- </td>
- <td align="left"
valign="bottom">
- <form
method="post" action="searchProducts.do">
- <input
name="keyword" size="14" />
- <input
border="0" src="images/search.gif" type="image" />
- </form>
- </td>
- </tr>
- </tbody>
- </table>
- <center>
- <a
href="viewCategory.do?categoryId=FISH"><img border="0" src="images/sm_fish.gif"
/></a>
- <img border="0"
src="images/separator.gif" hspace="4" />
- <a
href="viewCategory.do?categoryId=DOGS"><img border="0" src="images/sm_dogs.gif"
/></a>
- <img border="0"
src="images/separator.gif" hspace="4" />
- <a
href="viewCategory.do?categoryId=REPTILES"><img border="0"
src="images/sm_reptiles.gif" /></a>
- <img border="0"
src="images/separator.gif" hspace="4" />
- <a
href="viewCategory.do?categoryId=CATS"><img border="0" src="images/sm_cats.gif"
/></a>
- <img border="0"
src="images/separator.gif" hspace="4" />
- <a
href="viewCategory.do?categoryId=BIRDS"><img border="0"
src="images/sm_birds.gif" /></a>
- </center>
- <xsl:apply-templates/>
- <br/>
- <p align="center">
- <a href="http://cocoon.apache.org"><img
border="0" align="center" src="images/cocoon.gif" /></a>
- </p>
- </body>
- </html>
- </xsl:template>
-
- <xsl:template match="welcome">
- <table border="0" cellspacing="0" width="100%">
- <tbody>
- <tr>
- <td valign="top" width="100%">
- <table align="left" border="0"
cellspacing="0" width="80%">
- <tbody>
- <tr>
- <td
valign="top">
-
<xsl:apply-templates/>
- </td>
- <td
align="center" bgcolor="white" height="300" width="100%">
-
<map name="estoremap">
-
<area alt="Birds" coords="72,2,280,250"
href="viewCategory.do?categoryId=BIRDS" shape="RECT" />
-
<area alt="Fish" coords="2,180,72,250"
href="viewCategory.do?categoryId=FISH" shape="RECT" />
-
<area alt="Dogs" coords="60,250,130,320"
href="viewCategory.do?categoryId=DOGS" shape="RECT" />
-
<area alt="Reptiles" coords="140,270,210,340"
href="viewCategory.do?categoryId=REPTILES" shape="RECT" />
-
<area alt="Cats" coords="225,240,295,310"
href="viewCategory.do?categoryId=CATS" shape="RECT" />
-
<area alt="Birds" coords="280,180,350,250"
href="viewCategory.do?categoryId=BIRDS" shape="RECT" />
-
</map>
-
<img border="0" height="355" src="images/splash.gif" align="center"
usemap="#estoremap" width="350" />
- </td>
- </tr>
- </tbody>
- </table>
- </td>
- </tr>
- </tbody>
- </table>
- </xsl:template>
-
- <xsl:template match="menu">
- <table bgcolor="#FFFF88" border="0" cellspacing="0"
cellpadding="5" width="200">
- <tbody>
- <tr>
- <td>
- <!--
- #if (!$accountForm.signOn)
- <b><i><font size="2"
color="BLACK">Welcome $accountForm.account.firstName!</font></i></b>
- #end
- -->
- </td>
- </tr>
- <xsl:apply-templates/>
- </tbody>
- </table>
- </xsl:template>
-
- <xsl:template match="menu/category">
- <tr>
- <td>
- <a href="[EMAIL
PROTECTED]"><i><h2><xsl:value-of select="@name" /></h2></i></a>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="backpointer">
- <table align="left" bgcolor="#008800" border="0"
cellspacing="2" cellpadding="2">
- <tr>
- <td bgcolor="#FFFF88">
- <a href="[EMAIL PROTECTED]"><b><font
color="BLACK" size="2"><< <xsl:value-of select="@name" /></font></b></a>
- </td>
- </tr>
- </table>
- </xsl:template>
-
- <xsl:template match="category">
- <p>
- <center>
- <h2><xsl:value-of select="@name" /></h2>
- </center>
- <table align="center" bgcolor="#008800" border="0"
cellspacing="2" cellpadding="3">
- <tr bgcolor="#CCCCCC">
- <td>
- <b>Product ID</b>
- </td>
- <td>
- <b>Name</b>
- </td>
- </tr>
- <xsl:apply-templates/>
- </table>
- </p>
- </xsl:template>
-
- <xsl:template match="category/product">
- <tr bgcolor="#FFFF88">
- <td>
- <b><a href="[EMAIL PROTECTED]"><font
color="BLACK"><xsl:value-of select="@id" /></font></a></b>
- </td>
- <td>
- <xsl:value-of select="@name" />
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="search">
- <table align="center" bgcolor="#008800" border="0"
cellspacing="2" cellpadding="3">
- <tr bgcolor="#CCCCCC">
- <td></td>
- <td>
- <b>Product ID</b>
- </td>
- <td>
- <b>Name</b>
- </td>
- </tr>
-
- <xsl:apply-templates/>
- </table>
-
- </xsl:template>
-
- <xsl:template match="search/product">
- <tr bgcolor="#FFFF88">
- <td><a href="[EMAIL PROTECTED]"><xsl:value-of
select="product-desc" /></a></td>
- <td>
- <b><a href="[EMAIL PROTECTED]"><font
color="BLACK"><xsl:value-of select="@id" /></font></a></b>
- </td>
- <td><xsl:value-of select="@name" /></td>
- </tr>
- </xsl:template>
-
- <xsl:template match="situation">
- <tr>
- <td>
- <xsl:if test="@firstPage='false'" >
- <a href="[EMAIL PROTECTED]"><font
color="white"><B><< Prev</B></font></a>
- </xsl:if>
- <xsl:if test="@lastPage='false'" >
- <a href="[EMAIL PROTECTED]"><font
color="white"><B>Next >></B></font></a>
- </xsl:if>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="product">
- <p>
- <center>
- <b><font size="4"><xsl:value-of select="@name"
/></font></b>
- </center>
-
- <table align="center" bgcolor="#008800" border="0"
cellspacing="2" cellpadding="3">
- <tr bgcolor="#CCCCCC">
- <td><b>Item ID</b></td>
- <td><b>Product ID</b></td>
- <td><b>Description</b></td>
- <td><b>List Price</b></td>
- <td></td>
- </tr>
- <xsl:apply-templates/>
- </table>
- </p>
- </xsl:template>
-
- <xsl:template match="product/item">
- <tr bgcolor="#FFFF88">
- <td>
- <b><a href="[EMAIL PROTECTED]"><xsl:value-of
select="@id" /></a></b>
- </td>
- <td>
- <b><xsl:value-of select="@product-id" /></b>
- </td>
- <td>
- <xsl:value-of select="desc" /><xsl:text>
</xsl:text><xsl:value-of select="../@name" />
- </td>
- <td>
- <xsl:text>$</xsl:text> <xsl:value-of
select="price" />
- </td>
- <td>
- <a href="[EMAIL PROTECTED]"><img border="0"
src="images/button_add_to_cart.gif" /></a>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template name="cart-common-columns">
- <td><b>Item ID</b></td>
- <td><b>Product ID</b></td>
- <td><b>Description</b></td>
- <td><b>Quantity</b></td>
- <td><b>List Price</b></td>
- </xsl:template>
-
- <xsl:template match="[EMAIL PROTECTED]'Shopping Cart']">
- <table border="0" width="100%" cellspacing="0" cellpadding="0">
- <tr>
- <td valign="top" width="20%" align="left">
- <xsl:apply-templates
select="backpointer" />
- </td>
- <td valign="top" align="center">
- <h2 align="center"><xsl:value-of
select="@name" /></h2>
- <form action="updateCartQuantities.do"
method="post" >
- <table align="center"
bgcolor="#008800" border="0" cellspacing="2" cellpadding="5">
- <tr bgcolor="#cccccc">
-
<xsl:call-template name="cart-common-columns" />
- <td></td>
- </tr>
- <xsl:if
test="not(item)">
- <tr
bgcolor="#FFFF88">
- <td
colspan="6">
-
<b>Your cart is empty.</b>
- </td>
- </tr>
- </xsl:if>
- <xsl:apply-templates
select="item" />
- <tr bgcolor="#FFFF88">
- <td colspan="5"
align="right">
- <b>Sub
Total: $<xsl:value-of select="format-number (total, '###,##0.00')"/></b><br />
- <input
type="image" border="0" src="images/button_update_cart.gif" name="update" />
- </td>
- <td></td>
- </tr>
- </table>
- </form>
- <xsl:if test="item">
- <xsl:apply-templates
select="nextpointer" />
- </xsl:if>
- </td>
- <td valign="top" width="20%" align="right">
- </td>
- </tr>
- </table>
- </xsl:template>
-
- <xsl:template match="[EMAIL PROTECTED]'Checkout Summary']">
- <table border="0" width="100%" cellspacing="0" cellpadding="0">
- <tr>
- <td valign="top" width="20%" align="left">
- <xsl:apply-templates
select="backpointer" />
- </td>
- <td valign="top" align="center">
- <h2 align="center"><xsl:value-of
select="@name" /></h2>
- <table align="center"
bgcolor="#008800" border="0" cellspacing="2" cellpadding="5">
- <tr bgcolor="#cccccc">
-
<xsl:call-template name="cart-common-columns" />
- </tr>
- <xsl:apply-templates
select="item" />
- <tr bgcolor="#FFFF88">
- <td colspan="5"
align="right">
- <b>Sub
Total: $<xsl:value-of select="format-number (total, '###,##0.00')"/></b><br />
- </td>
- </tr>
- </table>
- <xsl:apply-templates
select="nextpointer" />
- </td>
- <td valign="top" width="20%" align="right">
- </td>
- </tr>
- </table>
- </xsl:template>
-
- <xsl:template match="[EMAIL PROTECTED]'Status']">
- <table align="center" bgcolor="#008800" border="0"
cellspacing="2" cellpadding="5">
- <tr bgcolor="#cccccc">
- <xsl:call-template name="cart-common-columns" />
- </tr>
- <xsl:apply-templates select="item" />
- <tr bgcolor="#FFFF88">
- <td colspan="5" align="right">
- <b>Total: $<xsl:value-of
select="format-number (total, '###,##0.00')"/></b><br />
- </td>
- </tr>
- </table>
- </xsl:template>
-
-
- <xsl:template match="nextpointer">
- <br />
- <center>
- <a href="[EMAIL PROTECTED]"><img border="0"
src="[EMAIL PROTECTED]" /></a>
- </center>
- </xsl:template>
-
-
- <xsl:template match="cart/item">
- <tr bgcolor="#FFFF88">
- <td>
- <b><xsl:value-of select="@id" /></b>
- </td>
- <td>
- <xsl:value-of select="@product-id" />
- </td>
- <td>
- <xsl:value-of select="desc" />
- </td>
- <td align="center">
- <xsl:choose>
- <xsl:when test="../@name='Shopping
Cart'">
- <input type="text" size="3"
name="[EMAIL PROTECTED]" >
- <xsl:attribute
name="value"><xsl:value-of select="format-number (quantity,
'####')"/></xsl:attribute>
- </input>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
select="format-number (quantity, '####')"/>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- <td align="right">
- $<xsl:value-of select="format-number (price,
'###,##0.00')"/>
- </td>
- <xsl:if test="../@name='Shopping Cart'">
- <td>
- <a href="[EMAIL PROTECTED]"><img
border="0" src="images/button_remove.gif" /></a>
- </td>
- </xsl:if>
- </tr>
- </xsl:template>
-
-
-
-
- <xsl:template match="item">
- <p>
- <table align="center" bgcolor="#008800" cellspacing="2"
cellpadding="3" border="0" width="60%">
- <tr bgcolor="#FFFF88">
- <td bgcolor="#FFFFFF">
- <xsl:value-of
select="product-desc" />
- </td>
- </tr>
- <tr bgcolor="#FFFF88">
- <td width="100%" bgcolor="#cccccc">
- <b><xsl:value-of select="@id" /></b>
- </td>
- </tr>
- <tr bgcolor="#FFFF88">
- <td>
- <b><font size="4"><xsl:value-of
select="desc" /></font></b>
- </td>
- </tr>
- <tr bgcolor="#FFFF88">
- <td>
- <font size="3"><i><xsl:value-of
select="product-name" /></i></font>
- </td>
- </tr>
- <!-- quantity stuff still missing -->
-
- <tr bgcolor="#FFFF88">
- <td>
- <xsl:value-of
select="format-number (instock, '####')"/> in stock.
- </td>
- </tr>
- <tr bgcolor="#FFFF88">
- <td>
- $<xsl:value-of
select="format-number (price, '###,##0.00')"/>
- </td>
- </tr>
- <tr bgcolor="#FFFF88">
- <td>
- <a href="[EMAIL PROTECTED]"
><img border="0" src="images/button_add_to_cart.gif" /></a>
- </td>
- </tr>
- </table>
- </p>
- </xsl:template>
-
- <xsl:template match="[EMAIL PROTECTED]'workingAccountForm']">
- <form>
- <xsl:copy-of select="@action | @method | @styleId "/>
- <xsl:choose>
- <xsl:when test="/site/@signOn='true'">
- <hidden name="workingAccountForm"
property="validate" value="newAccount"/>
- </xsl:when>
- <xsl:otherwise>
- <hidden name="workingAccountForm"
property="validate" value="editAccount" />
- <hidden name="workingAccountForm"
property="account.username" />
- </xsl:otherwise>
- </xsl:choose>
- <table cellpadding="10" cellspacing="0" align="center"
border="1" bgcolor="#dddddd">
- <tr>
- <td>
- <xsl:apply-templates/>
- </td>
- </tr>
- </table>
- <br />
- <center>
- <input border="0" type="image"
src="images/button_submit.gif" name="submit" value="Save Account Information" />
- </center>
- </form>
- <xsl:if test="/site/@signOn='false'">
- <p>
- <center><b><a href="listOrders.do">My
Orders</a></b></center>
- </p>
- </xsl:if>
- </xsl:template>
-
-
- <xsl:template match="[EMAIL PROTECTED]'workingOrderForm']">
- <b><font color="RED"><xsl:value-of select="message"
/></font></b>
- <form>
- <xsl:copy-of select="@action | @method | @styleId"/>
- <xsl:apply-templates/>
- <p>
- <input type="image" src="images/button_submit.gif"/>
- </p>
- </form>
- </xsl:template>
-
- <xsl:template match="[EMAIL PROTECTED]'signon']">
- <xsl:apply-templates select="message"/>
- <form>
- <xsl:copy-of select="@action | @method"/>
- <table align="center" border="0">
- <tr>
- <td colspan="2">Please enter your
username and password.<br /> </td>
- </tr>
- <xsl:apply-templates select="input"/>
- </table>
- </form>
- </xsl:template>
-
-
- <xsl:template match="panel[panel]">
- <table width="60%" align="center" border="0" cellpadding="3"
cellspacing="1" bgcolor="#FFFF88">
- <xsl:if test="@header">
- <tr bgcolor="#FFFF88">
- <td align="center" colspan="2">
- <font size="4"><b><xsl:value-of
select="@header" /></b></font>
- <xsl:if test="@subheader">
- <br /><font
size="3"><b><xsl:value-of select="@subheader" /></b></font>
- </xsl:if>
- </td>
- </tr>
- </xsl:if>
- <xsl:apply-templates/>
- </table>
- </xsl:template>
-
- <xsl:template match="panel">
- <font color="darkgreen"><h3><xsl:value-of select="@label"
/></h3></font>
- <table border="0" cellpadding="3" cellspacing="1"
bgcolor="#008800">
- <xsl:apply-templates/>
- </table>
- </xsl:template>
-
- <xsl:template match="panel/panel">
- <tr bgcolor="#FFFF88">
- <td colspan="2">
- <font color="GREEN" size="4"><b><xsl:value-of
select="@label" />:</b></font>
- </td>
- </tr>
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="panel/select">
- <tr bgcolor="#FFFF88">
- <td><xsl:value-of select="@label" /></td>
- <td>
- <select>
- <xsl:copy-of select="@type | @src |
@value | @name | @size | @selected | node()" />
- </select>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="panel/input">
- <tr bgcolor="#FFFF88">
- <td><xsl:value-of select="@label" /></td>
- <td><input><xsl:copy-of select="@type | @src | @value |
@name | @size | @selected"/></input></td>
- </tr>
- </xsl:template>
-
- <xsl:template match="panel/field">
- <tr bgcolor="#FFFF88">
- <td><xsl:value-of select="@label" />:</td>
- <td><xsl:value-of select="." /></td>
- </tr>
- </xsl:template>
-
- <xsl:template match="panel/[EMAIL PROTECTED]">
- <tr bgcolor="#FFFF88">
- <td colspan="[EMAIL PROTECTED]"><xsl:value-of
select="@label" />
- <xsl:apply-templates />
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="message">
- <br clear="all" />
- <center>
- <b>
- <font size="4">
- <xsl:if test="@type='warning'">
- <xsl:attribute
name="color">RED</xsl:attribute>
- </xsl:if>
- <xsl:value-of select="." />
- </font>
- </b>
- </center>
- <br clear="all" />
- </xsl:template>
-
-
- <xsl:template match="input">
- <tr>
- <td><xsl:value-of select="@label" /></td>
- <td><input><xsl:copy-of select="@type | @src | @value |
@name | @size | @selected"/></input></td>
- </tr>
- </xsl:template>
-
-
- <xsl:template match="register">
- <center>
- <a href="newAccountForm.do"><img border="0"
src="images/button_register_now.gif" /></a>
- </center>
- </xsl:template>
-
-
-<!-- XML-Form -->
-
-
- <xsl:template match="xf:[EMAIL PROTECTED]'edit-account']">
- <form>
- <xsl:copy-of select="@*"/>
- <input type="hidden" name="cocoon-xmlform-view"
value="[EMAIL PROTECTED]"/>
- <table cellpadding="10" cellspacing="0" align="center"
border="1" bgcolor="#dddddd">
-
- <xsl:if test="count(error/xf:violation) > 0">
- <tr>
- <td align="left" colspan="3"
-
class="{error/xf:violation[1]/@class}">
- <p>* There are
[<b><xsl:value-of
-
select="count(error/xf:violation)"/></b>]
- errors. Please
fix these errors and submit the
- form again.</p>
- </td>
- </tr>
- </xsl:if>
-
- <tr>
- <td>
- <xsl:apply-templates select="*[name()
!= 'xf:submit']" />
- </td>
- </tr>
- </table>
- <br />
- <center>
- <!--<input border="0" type="image"
src="images/button_submit.gif" name="submit" value="Save Account Information"
id="{xf:submit/@id}" continuation="forward"/> -->
- <xsl:apply-templates select="xf:submit" />
- </center>
- </form>
- <xsl:if test="/site/@signOn='false'">
- <p>
- <center><b><a href="listOrders.do">My
Orders</a></b></center>
- </p>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="xf:group/xf:caption" />
- <xsl:template match="xf:hint">
- <xsl:attribute name="title"><xsl:value-of
select="."/></xsl:attribute>
- </xsl:template>
- <xsl:template match="xf:violation" />
-
- <xsl:template match="xf:group">
- <font color="darkgreen"><h3><xsl:value-of select="xf:caption"
/></h3></font>
- <table border="0" cellpadding="3" cellspacing="1"
bgcolor="#008800">
- <xsl:apply-templates/>
- </table>
- </xsl:template>
-
-
- <xsl:template match="xf:textbox">
- <tr bgcolor="#FFFF88">
- <td><xsl:value-of select="xf:caption" /></td>
- <td>
- <input name="[EMAIL PROTECTED]" type="textbox"
value="{xf:value/text()}">
- <xsl:copy-of
select="@*[not(name()='ref')]"/>
- </input>
- <xsl:apply-templates select="xf:hint"/>
- <xsl:apply-templates select="xf:violation"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="xf:password">
- <tr bgcolor="#FFFF88">
- <td><xsl:value-of select="xf:caption" /></td>
- <td>
- <input name="[EMAIL PROTECTED]" type="password"
value="{xf:value/text()}">
- <xsl:copy-of
select="@*[not(name()='ref')]"/>
- </input>
- <xsl:apply-templates select="xf:violation"/>
- </td>
- </tr>
- </xsl:template>
-
-
- <xsl:template match="xf:selectOne | xf:[EMAIL PROTECTED]'listbox']">
- <tr bgcolor="#FFFF88">
- <td><xsl:value-of select="xf:caption" /></td>
- <td>
- <select name="[EMAIL PROTECTED]">
- <xsl:copy-of
select="@*[not(name()='ref')]"/>
- <xsl:variable name="selected"
select="xf:value"/>
- <xsl:for-each select="xf:item">
- <option value="{xf:value}">
- <xsl:if test="$selected
= xf:value">
- <xsl:attribute
name="selected"/>
- </xsl:if>
- <xsl:value-of
select="xf:caption"/>
- </option>
- </xsl:for-each>
- </select>
- <xsl:apply-templates select="xf:violation"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="xf:selectBoolean">
- <tr bgcolor="#FFFF88">
- <td colspan="2">
- <input name="[EMAIL PROTECTED]" type="checkbox"
value="true">
- <xsl:copy-of
select="@*[not(name()='ref')]"/>
- <xsl:if test="xf:value/text() = 'true'">
- <xsl:attribute name="checked"/>
- </xsl:if>
- </input>
- <xsl:value-of select="xf:caption" />
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="xf:submit">
- <!-- the id attribute of the submit control is sent to the server -->
- <!-- as a conventional Cocoon Action parameter of the form
cocoon-action-* -->
- <input name="[EMAIL PROTECTED]" type="submit"
value="{xf:caption/text()}">
- <xsl:copy-of select="@*[not(name()='id')]"/>
- <xsl:apply-templates select="xf:hint"/>
- </input>
- </xsl:template>
-
-</xsl:stylesheet>
-
+<?xml version="1.0" encoding="utf-8"?>
+
+
+<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xf="http://cocoon.apache.org/jxforms/2002/cr"
+ exclude-result-prefixes="xalan" >
+
+ <xsl:template match="site">
+ <html>
+ <head>
+ <meta content="text/html; charset=windows-1252"
http-equiv="Content-Type" />
+ <meta HTTP-EQUIV="Cache-Control"
CONTENT="max-age=0"/>
+ <meta HTTP-EQUIV="Cache-Control"
CONTENT="no-cache"/>
+ <meta http-equiv="expires" content="0"/>
+ <meta HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan
1980 1:00:00 GMT"/>
+ <meta HTTP-EQUIV="Pragma" CONTENT="no-cache"/>
+ </head>
+ <body bgcolor="white">
+ <table background="images/bkg-topbar.gif"
border="0" cellspacing="0" cellpadding="5" width="100%">
+ <tbody>
+ <tr>
+ <td>
+ <form method="post"
action="index.do">
+ <input
type="image" border="0" src="images/logo-topbar.gif" />
+ <select
name="view" width="14" align="left" onChange="document.forms[0].submit()">
+ <xsl:choose>
+
<xsl:when test="@view='jxpath'">
+
<option value="JXPath">JXPath</option>
+
<option value="Jexl">Jexl</option>
+
<option value="Xsp">Xsp</option>
+
<option value="Velocity">Velocity</option>
+
</xsl:when>
+
<xsl:when test="@view='jexl'">
+
<option value="Jexl">Jexl</option>
+
<option value="JXPath">JXPath</option>
+
<option value="Xsp">Xsp</option>
+
<option value="Velocity">Velocity</option>
+
</xsl:when>
+
<xsl:otherwise>
+
<option value="Xsp">Xsp</option>
+
<option value="JXPath">JXPath</option>
+
<option value="Jexl">Jexl</option>
+
<option value="Velocity">Velocity</option>
+
</xsl:otherwise>
+
</xsl:choose>
+ </select>
+ </form>
+ </td>
+ <td align="right">
+ <a
href="viewCart.do"><img border="0" name="img_cart" src="images/cart.gif"
/></a><img border="0" src="images/separator.gif" hspace="4" />
+ <xsl:choose>
+
<xsl:when test="@signOn='true'">
+
<a href="signonForm.do"><img border="0" name="img_signin"
src="images/sign-in.gif" /></a>
+
</xsl:when>
+
<xsl:otherwise>
+
<a href="signonForm.do?signoff=true"><img border="0" name="img_signout"
src="images/sign-out.gif" /></a><img border="0" src="images/separator.gif"
hspace="4" />
+
<a href="editAccount.form"><img border="0" name="img_myaccount"
src="images/my_account.gif" /></a>
+
</xsl:otherwise>
+ </xsl:choose>
+ <img border="0"
src="images/separator.gif" hspace="4" /><a href="../help.html"><img border="0"
name="img_help" src="images/help.gif" /></a>
+ </td>
+ <td align="left"
valign="bottom">
+ <form
method="post" action="searchProducts.do">
+ <input
name="keyword" size="14" />
+ <input
border="0" src="images/search.gif" type="image" />
+ </form>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <center>
+ <a
href="viewCategory.do?categoryId=FISH"><img border="0" src="images/sm_fish.gif"
/></a>
+ <img border="0"
src="images/separator.gif" hspace="4" />
+ <a
href="viewCategory.do?categoryId=DOGS"><img border="0" src="images/sm_dogs.gif"
/></a>
+ <img border="0"
src="images/separator.gif" hspace="4" />
+ <a
href="viewCategory.do?categoryId=REPTILES"><img border="0"
src="images/sm_reptiles.gif" /></a>
+ <img border="0"
src="images/separator.gif" hspace="4" />
+ <a
href="viewCategory.do?categoryId=CATS"><img border="0" src="images/sm_cats.gif"
/></a>
+ <img border="0"
src="images/separator.gif" hspace="4" />
+ <a
href="viewCategory.do?categoryId=BIRDS"><img border="0"
src="images/sm_birds.gif" /></a>
+ </center>
+ <xsl:apply-templates/>
+ <br/>
+ <p align="center">
+ <a href="http://cocoon.apache.org"><img
border="0" align="center" src="images/cocoon.gif" /></a>
+ </p>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template match="welcome">
+ <table border="0" cellspacing="0" width="100%">
+ <tbody>
+ <tr>
+ <td valign="top" width="100%">
+ <table align="left" border="0"
cellspacing="0" width="80%">
+ <tbody>
+ <tr>
+ <td
valign="top">
+
<xsl:apply-templates/>
+ </td>
+ <td
align="center" bgcolor="white" height="300" width="100%">
+
<map name="estoremap">
+
<area alt="Birds" coords="72,2,280,250"
href="viewCategory.do?categoryId=BIRDS" shape="RECT" />
+
<area alt="Fish" coords="2,180,72,250"
href="viewCategory.do?categoryId=FISH" shape="RECT" />
+
<area alt="Dogs" coords="60,250,130,320"
href="viewCategory.do?categoryId=DOGS" shape="RECT" />
+
<area alt="Reptiles" coords="140,270,210,340"
href="viewCategory.do?categoryId=REPTILES" shape="RECT" />
+
<area alt="Cats" coords="225,240,295,310"
href="viewCategory.do?categoryId=CATS" shape="RECT" />
+
<area alt="Birds" coords="280,180,350,250"
href="viewCategory.do?categoryId=BIRDS" shape="RECT" />
+
</map>
+
<img border="0" height="355" src="images/splash.gif" align="center"
usemap="#estoremap" width="350" />
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="menu">
+ <table bgcolor="#FFFF88" border="0" cellspacing="0"
cellpadding="5" width="200">
+ <tbody>
+ <tr>
+ <td>
+ <!--
+ #if (!$accountForm.signOn)
+ <b><i><font size="2"
color="BLACK">Welcome $accountForm.account.firstName!</font></i></b>
+ #end
+ -->
+ </td>
+ </tr>
+ <xsl:apply-templates/>
+ </tbody>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="menu/category">
+ <tr>
+ <td>
+ <a href="[EMAIL
PROTECTED]"><i><h2><xsl:value-of select="@name" /></h2></i></a>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="backpointer">
+ <table align="left" bgcolor="#008800" border="0"
cellspacing="2" cellpadding="2">
+ <tr>
+ <td bgcolor="#FFFF88">
+ <a href="[EMAIL PROTECTED]"><b><font
color="BLACK" size="2"><< <xsl:value-of select="@name" /></font></b></a>
+ </td>
+ </tr>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="category">
+ <p>
+ <center>
+ <h2><xsl:value-of select="@name" /></h2>
+ </center>
+ <table align="center" bgcolor="#008800" border="0"
cellspacing="2" cellpadding="3">
+ <tr bgcolor="#CCCCCC">
+ <td>
+ <b>Product ID</b>
+ </td>
+ <td>
+ <b>Name</b>
+ </td>
+ </tr>
+ <xsl:apply-templates/>
+ </table>
+ </p>
+ </xsl:template>
+
+ <xsl:template match="category/product">
+ <tr bgcolor="#FFFF88">
+ <td>
+ <b><a href="[EMAIL PROTECTED]"><font
color="BLACK"><xsl:value-of select="@id" /></font></a></b>
+ </td>
+ <td>
+ <xsl:value-of select="@name" />
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="search">
+ <table align="center" bgcolor="#008800" border="0"
cellspacing="2" cellpadding="3">
+ <tr bgcolor="#CCCCCC">
+ <td></td>
+ <td>
+ <b>Product ID</b>
+ </td>
+ <td>
+ <b>Name</b>
+ </td>
+ </tr>
+
+ <xsl:apply-templates/>
+ </table>
+
+ </xsl:template>
+
+ <xsl:template match="search/product">
+ <tr bgcolor="#FFFF88">
+ <td><a href="[EMAIL PROTECTED]"><xsl:value-of
select="product-desc" /></a></td>
+ <td>
+ <b><a href="[EMAIL PROTECTED]"><font
color="BLACK"><xsl:value-of select="@id" /></font></a></b>
+ </td>
+ <td><xsl:value-of select="@name" /></td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="situation">
+ <tr>
+ <td>
+ <xsl:if test="@firstPage='false'" >
+ <a href="[EMAIL PROTECTED]"><font
color="white"><B><< Prev</B></font></a>
+ </xsl:if>
+ <xsl:if test="@lastPage='false'" >
+ <a href="[EMAIL PROTECTED]"><font
color="white"><B>Next >></B></font></a>
+ </xsl:if>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="product">
+ <p>
+ <center>
+ <b><font size="4"><xsl:value-of select="@name"
/></font></b>
+ </center>
+
+ <table align="center" bgcolor="#008800" border="0"
cellspacing="2" cellpadding="3">
+ <tr bgcolor="#CCCCCC">
+ <td><b>Item ID</b></td>
+ <td><b>Product ID</b></td>
+ <td><b>Description</b></td>
+ <td><b>List Price</b></td>
+ <td></td>
+ </tr>
+ <xsl:apply-templates/>
+ </table>
+ </p>
+ </xsl:template>
+
+ <xsl:template match="product/item">
+ <tr bgcolor="#FFFF88">
+ <td>
+ <b><a href="[EMAIL PROTECTED]"><xsl:value-of
select="@id" /></a></b>
+ </td>
+ <td>
+ <b><xsl:value-of select="@product-id" /></b>
+ </td>
+ <td>
+ <xsl:value-of select="desc" /><xsl:text>
</xsl:text><xsl:value-of select="../@name" />
+ </td>
+ <td>
+ <xsl:text>$</xsl:text> <xsl:value-of
select="price" />
+ </td>
+ <td>
+ <a href="[EMAIL PROTECTED]"><img border="0"
src="images/button_add_to_cart.gif" /></a>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template name="cart-common-columns">
+ <td><b>Item ID</b></td>
+ <td><b>Product ID</b></td>
+ <td><b>Description</b></td>
+ <td><b>Quantity</b></td>
+ <td><b>List Price</b></td>
+ </xsl:template>
+
+ <xsl:template match="[EMAIL PROTECTED]'Shopping Cart']">
+ <table border="0" width="100%" cellspacing="0" cellpadding="0">
+ <tr>
+ <td valign="top" width="20%" align="left">
+ <xsl:apply-templates
select="backpointer" />
+ </td>
+ <td valign="top" align="center">
+ <h2 align="center"><xsl:value-of
select="@name" /></h2>
+ <form action="updateCartQuantities.do"
method="post" >
+ <table align="center"
bgcolor="#008800" border="0" cellspacing="2" cellpadding="5">
+ <tr bgcolor="#cccccc">
+
<xsl:call-template name="cart-common-columns" />
+ <td></td>
+ </tr>
+ <xsl:if
test="not(item)">
+ <tr
bgcolor="#FFFF88">
+ <td
colspan="6">
+
<b>Your cart is empty.</b>
+ </td>
+ </tr>
+ </xsl:if>
+ <xsl:apply-templates
select="item" />
+ <tr bgcolor="#FFFF88">
+ <td colspan="5"
align="right">
+ <b>Sub
Total: $<xsl:value-of select="format-number (total, '###,##0.00')"/></b><br />
+ <input
type="image" border="0" src="images/button_update_cart.gif" name="update" />
+ </td>
+ <td></td>
+ </tr>
+ </table>
+ </form>
+ <xsl:if test="item">
+ <xsl:apply-templates
select="nextpointer" />
+ </xsl:if>
+ </td>
+ <td valign="top" width="20%" align="right">
+ </td>
+ </tr>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="[EMAIL PROTECTED]'Checkout Summary']">
+ <table border="0" width="100%" cellspacing="0" cellpadding="0">
+ <tr>
+ <td valign="top" width="20%" align="left">
+ <xsl:apply-templates
select="backpointer" />
+ </td>
+ <td valign="top" align="center">
+ <h2 align="center"><xsl:value-of
select="@name" /></h2>
+ <table align="center"
bgcolor="#008800" border="0" cellspacing="2" cellpadding="5">
+ <tr bgcolor="#cccccc">
+
<xsl:call-template name="cart-common-columns" />
+ </tr>
+ <xsl:apply-templates
select="item" />
+ <tr bgcolor="#FFFF88">
+ <td colspan="5"
align="right">
+ <b>Sub
Total: $<xsl:value-of select="format-number (total, '###,##0.00')"/></b><br />
+ </td>
+ </tr>
+ </table>
+ <xsl:apply-templates
select="nextpointer" />
+ </td>
+ <td valign="top" width="20%" align="right">
+ </td>
+ </tr>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="[EMAIL PROTECTED]'Status']">
+ <table align="center" bgcolor="#008800" border="0"
cellspacing="2" cellpadding="5">
+ <tr bgcolor="#cccccc">
+ <xsl:call-template name="cart-common-columns" />
+ </tr>
+ <xsl:apply-templates select="item" />
+ <tr bgcolor="#FFFF88">
+ <td colspan="5" align="right">
+ <b>Total: $<xsl:value-of
select="format-number (total, '###,##0.00')"/></b><br />
+ </td>
+ </tr>
+ </table>
+ </xsl:template>
+
+
+ <xsl:template match="nextpointer">
+ <br />
+ <center>
+ <a href="[EMAIL PROTECTED]"><img border="0"
src="[EMAIL PROTECTED]" /></a>
+ </center>
+ </xsl:template>
+
+
+ <xsl:template match="cart/item">
+ <tr bgcolor="#FFFF88">
+ <td>
+ <b><xsl:value-of select="@id" /></b>
+ </td>
+ <td>
+ <xsl:value-of select="@product-id" />
+ </td>
+ <td>
+ <xsl:value-of select="desc" />
+ </td>
+ <td align="center">
+ <xsl:choose>
+ <xsl:when test="../@name='Shopping
Cart'">
+ <input type="text" size="3"
name="[EMAIL PROTECTED]" >
+ <xsl:attribute
name="value"><xsl:value-of select="format-number (quantity,
'####')"/></xsl:attribute>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="format-number (quantity, '####')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ <td align="right">
+ $<xsl:value-of select="format-number (price,
'###,##0.00')"/>
+ </td>
+ <xsl:if test="../@name='Shopping Cart'">
+ <td>
+ <a href="[EMAIL PROTECTED]"><img
border="0" src="images/button_remove.gif" /></a>
+ </td>
+ </xsl:if>
+ </tr>
+ </xsl:template>
+
+
+
+
+ <xsl:template match="item">
+ <p>
+ <table align="center" bgcolor="#008800" cellspacing="2"
cellpadding="3" border="0" width="60%">
+ <tr bgcolor="#FFFF88">
+ <td bgcolor="#FFFFFF">
+ <xsl:value-of
select="product-desc" />
+ </td>
+ </tr>
+ <tr bgcolor="#FFFF88">
+ <td width="100%" bgcolor="#cccccc">
+ <b><xsl:value-of select="@id" /></b>
+ </td>
+ </tr>
+ <tr bgcolor="#FFFF88">
+ <td>
+ <b><font size="4"><xsl:value-of
select="desc" /></font></b>
+ </td>
+ </tr>
+ <tr bgcolor="#FFFF88">
+ <td>
+ <font size="3"><i><xsl:value-of
select="product-name" /></i></font>
+ </td>
+ </tr>
+ <!-- quantity stuff still missing -->
+
+ <tr bgcolor="#FFFF88">
+ <td>
+ <xsl:value-of
select="format-number (instock, '####')"/> in stock.
+ </td>
+ </tr>
+ <tr bgcolor="#FFFF88">
+ <td>
+ $<xsl:value-of
select="format-number (price, '###,##0.00')"/>
+ </td>
+ </tr>
+ <tr bgcolor="#FFFF88">
+ <td>
+ <a href="[EMAIL PROTECTED]"
><img border="0" src="images/button_add_to_cart.gif" /></a>
+ </td>
+ </tr>
+ </table>
+ </p>
+ </xsl:template>
+
+ <xsl:template match="editAccountForm">
+ <xsl:copy-of select="*"/>
+ </xsl:template>
+
+ <xsl:template match="[EMAIL PROTECTED]'workingAccountForm']">
+ <form>
+ <xsl:copy-of select="@action | @method | @styleId "/>
+ <xsl:choose>
+ <xsl:when test="/site/@signOn='true'">
+ <hidden name="workingAccountForm"
property="validate" value="newAccount"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <hidden name="workingAccountForm"
property="validate" value="editAccount" />
+ <hidden name="workingAccountForm"
property="account.username" />
+ </xsl:otherwise>
+ </xsl:choose>
+ <table cellpadding="10" cellspacing="0" align="center"
border="1" bgcolor="#dddddd">
+ <tr>
+ <td>
+ <xsl:apply-templates/>
+ </td>
+ </tr>
+ </table>
+ <br />
+ <center>
+ <input border="0" type="image"
src="images/button_submit.gif" name="submit" value="Save Account Information" />
+ </center>
+ </form>
+ <xsl:if test="/site/@signOn='false'">
+ <p>
+ <center><b><a href="listOrders.do">My
Orders</a></b></center>
+ </p>
+ </xsl:if>
+ </xsl:template>
+
+
+ <xsl:template match="[EMAIL PROTECTED]'workingOrderForm']">
+ <b><font color="RED"><xsl:value-of select="message"
/></font></b>
+ <form>
+ <xsl:copy-of select="@action | @method | @styleId"/>
+ <xsl:apply-templates/>
+ <p>
+ <input type="image" src="images/button_submit.gif"/>
+ </p>
+ </form>
+ </xsl:template>
+
+ <xsl:template match="[EMAIL PROTECTED]'signon']">
+ <xsl:apply-templates select="message"/>
+ <form>
+ <xsl:copy-of select="@action | @method"/>
+ <table align="center" border="0">
+ <tr>
+ <td colspan="2">Please enter your
username and password.<br /> </td>
+ </tr>
+ <xsl:apply-templates select="input"/>
+ </table>
+ </form>
+ </xsl:template>
+
+
+ <xsl:template match="panel[panel]">
+ <table width="60%" align="center" border="0" cellpadding="3"
cellspacing="1" bgcolor="#FFFF88">
+ <xsl:if test="@header">
+ <tr bgcolor="#FFFF88">
+ <td align="center" colspan="2">
+ <font size="4"><b><xsl:value-of
select="@header" /></b></font>
+ <xsl:if test="@subheader">
+ <br /><font
size="3"><b><xsl:value-of select="@subheader" /></b></font>
+ </xsl:if>
+ </td>
+ </tr>
+ </xsl:if>
+ <xsl:apply-templates/>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="panel">
+ <font color="darkgreen"><h3><xsl:value-of select="@label"
/></h3></font>
+ <table border="0" cellpadding="3" cellspacing="1"
bgcolor="#008800">
+ <xsl:apply-templates/>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="panel/panel">
+ <tr bgcolor="#FFFF88">
+ <td colspan="2">
+ <font color="GREEN" size="4"><b><xsl:value-of
select="@label" />:</b></font>
+ </td>
+ </tr>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="panel/select">
+ <tr bgcolor="#FFFF88">
+ <td><xsl:value-of select="@label" /></td>
+ <td>
+ <select>
+ <xsl:copy-of select="@type | @src |
@value | @name | @size | @selected | node()" />
+ </select>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="panel/input">
+ <tr bgcolor="#FFFF88">
+ <td><xsl:value-of select="@label" /></td>
+ <td><input><xsl:copy-of select="@type | @src | @value |
@name | @size | @selected"/></input></td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="panel/field">
+ <tr bgcolor="#FFFF88">
+ <td><xsl:value-of select="@label" />:</td>
+ <td><xsl:value-of select="." /></td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="panel/[EMAIL PROTECTED]">
+ <tr bgcolor="#FFFF88">
+ <td colspan="[EMAIL PROTECTED]"><xsl:value-of
select="@label" />
+ <xsl:apply-templates />
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="message">
+ <br clear="all" />
+ <center>
+ <b>
+ <font size="4">
+ <xsl:if test="@type='warning'">
+ <xsl:attribute
name="color">RED</xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="." />
+ </font>
+ </b>
+ </center>
+ <br clear="all" />
+ </xsl:template>
+
+
+ <xsl:template match="input">
+ <tr>
+ <td><xsl:value-of select="@label" /></td>
+ <td><input><xsl:copy-of select="@type | @src | @value |
@name | @size | @selected"/></input></td>
+ </tr>
+ </xsl:template>
+
+
+ <xsl:template match="register">
+ <center>
+ <a href="newAccountForm.do"><img border="0"
src="images/button_register_now.gif" /></a>
+ </center>
+ </xsl:template>
+
+</xsl:stylesheet>
+
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/jxforms/EditAccountInformation.xml
Index: EditAccountInformation.xml
===================================================================
<?xml version="1.0"?>
<site xmlns:xf="http://cocoon.apache.org/jxforms/2002/cr"
signOn="false" view="xsp">
<editAccountForm>
<xf:form id="petstore-edit-account" view="edit-account-info"
action="petstore" method="GET" class="petstore-form">
<error>
<xf:violations class="error"/>
</error>
<xf:group class="panel" ref="/account">
<xf:label class="header" >Account Information</xf:label>
<xf:input ref="/account/firstName">
<xf:label>First Name:</xf:label>
<xf:violations class="error"/>
</xf:input>
<xf:input ref="lastName">
<xf:label>Last Name:</xf:label>
<xf:violations class="error"/>
</xf:input>
<xf:input ref="email">
<xf:label>Email:</xf:label>
<xf:violations class="error"/>
</xf:input>
<xf:input ref="phone">
<xf:label>Phone:</xf:label>
<xf:violations class="error"/>
</xf:input>
<xf:input ref="address1">
<xf:label>Address 1:</xf:label>
<xf:violations class="error"/>
</xf:input>
<xf:input ref="address2">
<xf:label>Address 2:</xf:label>
<xf:violations class="error"/>
</xf:input>
<xf:input ref="city">
<xf:label>City:</xf:label>
<xf:violations class="error"/>
</xf:input>
<xf:input ref="state">
<xf:label>State:</xf:label>
<xf:violations class="error"/>
</xf:input>
<xf:input ref="zip">
<xf:label>Zip:</xf:label>
<xf:violations class="error"/>
</xf:input>
<xf:input ref="country">
<xf:label>Country:</xf:label>
<xf:violations class="error"/>
</xf:input>
</xf:group>
<xf:submit id="prev" continuation="back" class="button">
<xf:label>Back</xf:label>
<xf:hint>Go Back</xf:hint>
</xf:submit>
<xf:submit id="next" continuation="forward" class="button">
<xf:label>Next</xf:label>
<xf:hint>Continue</xf:hint>
</xf:submit>
</xf:form>
</editAccountForm>
</site>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/jxforms/EditProfileInformation.xml
Index: EditProfileInformation.xml
===================================================================
<?xml version="1.0"?>
<site xmlns:xf="http://cocoon.apache.org/jxforms/2002/cr"
signOn="false" view="xsp">
<editAccountForm>
<xf:form id="petstore-edit-account" view="edit-profile"
action="petstore" method="GET">
<error>
<xf:violations class="error"/>
</error>
<xf:group ref="/account">
<xf:label class="header">Profile Information</xf:label>
<xf:select1 ref="/account/favCategory">
<xf:label>Favorite Category:</xf:label>
<xf:itemset nodeset="/categoryList">
<xf:label><xf:output ref="name"/></xf:label>
<xf:value><xf:output ref="name"/></xf:value>
</xf:itemset>
</xf:select1>
<xf:select1 ref="/account/listOption">
<xf:label>Enable MyList</xf:label>
<xf:item>
<xf:label>Yes</xf:label>
<xf:value>true</xf:value>
</xf:item>
<xf:item>
<xf:label>No</xf:label>
<xf:value></xf:value>
</xf:item>
</xf:select1>
<xf:select1 ref="/account/bannerOption">
<xf:label>Enable MyBanner</xf:label>
<xf:item>
<xf:label>Yes</xf:label>
<xf:value>true</xf:value>
</xf:item>
<xf:item>
<xf:label>No</xf:label>
<xf:value></xf:value>
</xf:item>
</xf:select1>
</xf:group>
<xf:submit id="prev" continuation="back" class="button">
<xf:label>Back</xf:label>
<xf:hint>Go Back</xf:hint>
</xf:submit>
<xf:submit id="next" continuation="forward" class="button">
<xf:label>Finish</xf:label>
<xf:hint>Submit Account Information</xf:hint>
</xf:submit>
</xf:form>
</editAccountForm>
</site>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/jxforms/EditUserInformation.xml
Index: EditUserInformation.xml
===================================================================
<?xml version="1.0"?>
<site xmlns:xf="http://cocoon.apache.org/jxforms/2002/cr"
signOn="false" view="xsp">
<editAccountForm>
<xf:form id="petstore-edit-account" view="edit-user-info"
action="petstore" method="GET" class="petstore-form">
<error>
<xf:violations class="error"/>
</error>
<xf:group class="panel" ref="/">
<xf:label class="header">User Information</xf:label>
<xf:input ref="/username">
<xf:label>User ID:</xf:label>
<xf:violations class="error"/>
</xf:input>
<xf:secret ref="/password">
<xf:label>Password:</xf:label>
<xf:violations class="error"/>
</xf:secret>
<xf:secret ref="/password2">
<xf:label>Repeat Password:</xf:label>
<xf:violations class="error"/>
</xf:secret>
</xf:group>
<xf:submit id="next" continuation="forward" class="button">
<xf:label>Next</xf:label>
<xf:hint>Continue</xf:hint>
</xf:submit>
</xf:form>
</editAccountForm>
</site>