cziegeler 2002/07/01 23:27:06
Added: src/scratchpad/webapp/samples/sitebuilder sitemap.skel.xmap
sitemap.xmap
src/scratchpad/webapp/samples/sitebuilder/datasources
addElement.jsp cocoon_prefix.jspinclude
deleteElement.jsp menu.main.xml
src/scratchpad/webapp/samples/sitebuilder/datasources/forms
newMatchAggregate.xfdl newMatchGenerate.xfdl
newMatchGeneratePart.xfdl newMatchRead.xfdl
newMatchSerialize.xfdl newMatchTransform.xfdl
newPipelineMatch.xfdl newSitemapAction.xfdl
newSitemapGenerator.xfdl newSitemapMatcher.xfdl
newSitemapPipeline.xfdl newSitemapReader.xfdl
newSitemapSelector.xfdl newSitemapSerializer.xfdl
newSitemapTransformer.xfdl
src/scratchpad/webapp/samples/sitebuilder/staticContent
openSite.html sitebuilder.css
src/scratchpad/webapp/samples/sitebuilder/stylesheets
fragmentExtractor.xsl layout.2.xsl match.edit.xsl
menu.main.xsl operation-result.xsl
pipeline.edit.xsl replacer.xsp simple-page2html.xsl
sitemap.edit.xsl sitemap.openSubSite.xsl
sitemap.view.xsl sitemapEditHelper.xsl
staticSnippet.xsl xfdl-html.xsl
Removed: src/scratchpad/webapp/sitebuilder sitemap.skel.xmap
sitemap.xmap
src/scratchpad/webapp/sitebuilder/datasources addElement.jsp
cocoon_prefix.jspinclude deleteElement.jsp
menu.main.xml
src/scratchpad/webapp/sitebuilder/datasources/forms
newMatchAggregate.xfdl newMatchGenerate.xfdl
newMatchGeneratePart.xfdl newMatchRead.xfdl
newMatchSerialize.xfdl newMatchTransform.xfdl
newPipelineMatch.xfdl newSitemapAction.xfdl
newSitemapGenerator.xfdl newSitemapMatcher.xfdl
newSitemapPipeline.xfdl newSitemapReader.xfdl
newSitemapSelector.xfdl newSitemapSerializer.xfdl
newSitemapTransformer.xfdl
src/scratchpad/webapp/sitebuilder/staticContent
openSite.html sitebuilder.css
src/scratchpad/webapp/sitebuilder/stylesheets
fragmentExtractor.xsl layout.2.xsl match.edit.xsl
menu.main.xsl operation-result.xsl
pipeline.edit.xsl replacer.xsp simple-page2html.xsl
sitemap.edit.xsl sitemap.openSubSite.xsl
sitemap.view.xsl sitemapEditHelper.xsl
staticSnippet.xsl xfdl-html.xsl
Log:
Moved sitebuilder into samples
Revision Changes Path
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/sitemap.skel.xmap
Index: sitemap.skel.xmap
===================================================================
<?xml version="1.0"?>
<map:sitemap id="1" xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<!-- =========================== Components ================================
-->
<map:components id="2">
<map:generators id="3" default="file"/>
<map:transformers id="4" default="xslt"/>
<map:readers id="5" default="resource"/>
<map:serializers id="6" default="html"/>
<map:selectors id="7" default="browser"/>
<map:matchers id="8" default="wildcard">
<map:matcher id="9" name="wildcard"
src="org.apache.cocoon.matching.WildcardURIMatcher"/>
</map:matchers>
</map:components>
<!-- =========================== Pipelines =================================
-->
<map:pipelines id="10">
</map:pipelines>
</map:sitemap>
<!-- end of file -->
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/sitemap.xmap
Index: sitemap.xmap
===================================================================
<?xml version="1.0" encoding="iso-8859-1"?>
<map:sitemap id="1" xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<!-- =========================== Components ================================
-->
<map:components id="2" >
<map:generators id="3" default="file" />
<map:transformers id="4" default="xslt">
<map:transformer id="5" name="xslt"
src="org.apache.cocoon.transformation.TraxTransformer">
<use-store id="6">true</use-store>
<use-request-parameters id="7">true</use-request-parameters>
<use-browser-capabilities-db id="8">false</use-browser-capabilities-db>
</map:transformer>
</map:transformers>
<map:readers id="9" default="resource"/>
<map:serializers id="10" default="html"/>
<map:selectors id="11" default="browser"/>
<map:matchers id="12" default="wildcard">
<map:matcher id="13" name="wildcard"
src="org.apache.cocoon.matching.WildcardURIMatcher"/>
<map:matcher id="14" name="regexp"
src="org.apache.cocoon.matching.RegexpURIMatcher"/>
</map:matchers>
<map:actions id="15" >
<map:action id="16" name="request"
src="org.apache.cocoon.acting.RequestParamAction"/>
</map:actions>
</map:components>
<!-- =========================== Pipelines =================================
-->
<map:pipelines id="17">
<!-- ===- A. Readers (public) -->
<map:pipeline id="18">
<!-- Site-wide components -->
<map:match id="19" pattern="**img/**.gif">
<map:read id="20" src="img/{2}.gif" mime-type="image/gif"/>
</map:match>
<!-- Static files -->
<map:match id="21" pattern="staticFile/**.xml">
<map:generate id="22" src="staticContent/{1}.xml"/>
<map:serialize id="23"/>
</map:match>
<map:match id="25" pattern="staticFile/**.html">
<map:generate id="26" type="html" src="staticContent/{1}.html"/>
<map:serialize id="27"/>
</map:match>
<map:match id="28" pattern="staticFile/**.css">
<map:read id="29" src="staticContent/{1}.css" mime-type="text/css"/>
</map:match>
<map:match id="30" pattern="staticFile/**">
<map:read id="31" src="staticContent/{1}"
mime-type="application/octet-stream"/>
</map:match>
</map:pipeline>
<!-- ===- B. Site components (private) -->
<map:pipeline id="32" internal-only="true">
<!-- Dynamic stylesheets -->
<map:match id="33" pattern="component/replacer/*/">
<map:generate id="34" type="serverpages"
src="stylesheets/replacer.xsp">
<map:parameter id="35" name="toReplace" value="{1}"/>
</map:generate>
<map:serialize id="36" type="xml"/>
</map:match>
<!-- Web Site Navigation -->
<map:match id="37" pattern="component/menu/*">
<map:generate id="38" src="datasources/menu.{1}.xml"/>
<map:transform id="39" src="stylesheets/menu.{1}.xsl"/>
<map:serialize id="40"/>
</map:match>
<!-- Sitemap manipulation -->
<map:match id="41" pattern="component/sitemap/*/**">
<map:generate id="42" src="../{2}/sitemap.xmap"/>
<map:transform id="43" src="stylesheets/sitemap.{1}.xsl"/>
<map:serialize id="44"/>
</map:match>
<!-- Pipeline manipulation -->
<map:match id="45" pattern="component/pipeline/*/*/**">
<map:generate id="46" src="../{3}/sitemap.xmap"/>
<map:transform id="47" src="stylesheets/fragmentExtractor.xsl">
<map:parameter id="48" name="elementId" value="{2}" />
</map:transform>
<map:transform id="49" src="stylesheets/pipeline.{1}.xsl"/>
<map:serialize id="50"/>
</map:match>
<!-- Match manipulation -->
<map:match id="51" pattern="component/match/*/*/*/**">
<map:generate id="52" src="../{4}/sitemap.xmap"/>
<map:transform id="53" src="stylesheets/fragmentExtractor.xsl">
<map:parameter id="54" name="elementId" value="{2}" />
</map:transform>
<map:transform id="55" src="stylesheets/match.{1}.xsl"/>
<map:serialize id="56"/>
</map:match>
<!-- Forms -->
<map:match id="57" pattern="component/form/*/*/">
<map:generate id="58" src="datasources/forms/{1}.xfdl"/>
<map:transform id="59" src="cocoon:/component/replacer/{2}/"/>
<map:transform id="60" src="stylesheets/xfdl-html.xsl"/>
<map:serialize id="61"/>
</map:match>
<!-- XML document editing -->
<map:match id="62" pattern="component/deleteElement/*/**">
<map:generate id="63" type="jsp"
src="/sitebuilder/datasources/deleteElement.jsp" />
<map:transform id="64" src="stylesheets/operation-result.xsl" />
<map:serialize id="65" type="html"/>
</map:match>
<map:match id="66" pattern="component/addElement/**">
<map:generate id="67" type="jsp"
src="/sitebuilder/datasources/addElement.jsp"/>
<map:transform id="68" src="stylesheets/operation-result.xsl"/>
<map:serialize id="69" type="html"/>
</map:match>
</map:pipeline>
<!-- ===- C. Site definition (public) -->
<map:pipeline id="210">
<!-- Root Page -->
<map:match id="70" pattern="">
<map:redirect-to id="72" uri="openSubSite/" />
</map:match>
<map:match id="71" pattern="openSubSite/**">
<map:aggregate id="73" element="page">
<map:part id="74" src="cocoon:/component/menu/main"
element="layout-leftbar"/>
<map:part id="75" src="cocoon:/component/sitemap/openSubSite/"
element="layout-content" />
</map:aggregate>
<map:transform id="76" src="stylesheets/layout.2.xsl"/>
<map:serialize id="77"/>
</map:match>
<!-- Site Overview -->
<map:match id="78" pattern="sitemap/view/">
<map:act type="request">
<map:parameter id="79" name="parameters" value="true"/>
<map:aggregate id="80" element="page">
<map:part id="81" src="cocoon:/component/menu/main"
element="layout-leftbar"/>
<map:part id="82" src="cocoon:/component/sitemap/view/{siteName}/"
element="layout-content"/>
</map:aggregate>
<map:transform id="83" src="stylesheets/layout.2.xsl"/>
<map:serialize id="84"/>
</map:act>
</map:match>
<!-- Site Edit -->
<map:match id="85" pattern="sitemap/edit/">
<map:act type="request">
<map:parameter id="86" name="parameters" value="true"/>
<map:aggregate id="87" element="page">
<map:part id="88" src="cocoon:/component/menu/main"
element="layout-leftbar"/>
<map:part id="89" src="cocoon:/component/sitemap/edit/{siteName}/"
element="layout-content"/>
</map:aggregate>
<map:transform id="90" src="stylesheets/layout.2.xsl"/>
<map:serialize id="91"/>
</map:act>
</map:match>
<!-- Site Add New Element Form -->
<map:match id="92" pattern="sitemap/new*/">
<map:act type="request">
<map:parameter id="93" name="parameters" value="true"/>
<map:aggregate id="94" element="page">
<map:part id="95" src="cocoon:/component/menu/main"
element="layout-leftbar"/>
<map:part id="96"
src="cocoon:/component/form/newSitemap{../1}/siteName={siteName}/"
element="layout-content"/>
</map:aggregate>
<map:transform id="97" src="stylesheets/layout.2.xsl"/>
<map:serialize id="98"/>
</map:act>
</map:match>
<!-- Site Add New Element Processor -->
<map:match id="99" pattern="sitemap/new*/process">
<map:act type="request">
<map:parameter id="100" name="parameters" value="true"/>
<map:aggregate id="101" element="page">
<map:part id="102" src="cocoon:/component/menu/main"
element="layout-leftbar"/>
<map:part id="103"
src="cocoon:/component/addElement/{siteName}/sitemap.xmap"
element="layout-content"/>
</map:aggregate>
<map:transform id="104" src="stylesheets/layout.2.xsl"/>
<map:serialize id="105" />
</map:act>
</map:match>
<!-- Site Add New Element Results -->
<map:match id="106" pattern="sitemap/new*/success">
<map:act type="request">
<map:parameter id="107" name="parameters" value="true"/>
<map:redirect-to id="108"
uri="../../sitemap/edit/?siteName={siteName}"/>
</map:act>
</map:match>
<map:match id="109" pattern="sitemap/new*/failure">
<map:act type="request">
<map:parameter id="110" name="parameters" value="true"/>
<map:redirect-to id="111"
uri="../../sitemap/edit/?siteName={siteName}"/>
</map:act>
</map:match>
<!-- Site Delete Element Processor -->
<map:match id="112" pattern="sitemap/deleteElement/process">
<map:act type="request">
<map:parameter id="113" name="parameters" value="true"/>
<map:aggregate id="114" element="page">
<map:part id="115" src="cocoon:/component/menu/main"
element="layout-leftbar"/>
<map:part id="116"
src="cocoon:/component/deleteElement/{elementId}/{siteName}/sitemap.xmap"
element="layout-content"/>
</map:aggregate>
<map:transform id="117" src="stylesheets/layout.2.xsl"/>
<map:serialize id="118"/>
</map:act>
</map:match>
<!-- Site Delete Element Results -->
<map:match id="119" pattern="sitemap/deleteElement/success">
<map:act type="request">
<map:parameter id="120" name="parameters" value="true"/>
<map:redirect-to id="121"
uri="../../sitemap/edit/?siteName={siteName}"/>
</map:act>
</map:match>
<map:match id="122" pattern="sitemap/deleteElement/failure">
<map:act type="request">
<map:parameter id="123" name="parameters" value="true"/>
<map:redirect-to id="124"
uri="../../sitemap/edit/?siteName={siteName}"/>
</map:act>
</map:match>
<!-- Pipeline Edit -->
<map:match id="125" pattern="pipeline/edit/">
<map:act type="request">
<map:parameter id="126" name="parameters" value="true"/>
<map:aggregate id="127" element="page">
<map:part id="128" src="cocoon:/component/menu/main"
element="layout-leftbar"/>
<map:part id="129"
src="cocoon:/component/pipeline/edit/{pipelineId}/{siteName}/"
element="layout-content"/>
</map:aggregate>
<map:transform id="130" src="stylesheets/layout.2.xsl"/>
<map:serialize id="131"/>
</map:act>
</map:match>
<!-- Pipeline Add New Element Form -->
<map:match id="132" pattern="pipeline/new*/">
<map:act type="request">
<map:parameter id="133" name="parameters" value="true"/>
<map:aggregate id="134" element="page">
<map:part id="135" src="cocoon:/component/menu/main"
element="layout-leftbar"/>
<map:part id="136"
src="cocoon:/component/form/newPipeline{../1}/pipelineId={pipelineId}:siteName={siteName}/"
element="layout-content"/>
</map:aggregate>
<map:transform id="137" src="stylesheets/layout.2.xsl"/>
<map:serialize id="138"/>
</map:act>
</map:match>
<!-- Pipeline Add New Element Processor -->
<map:match id="139" pattern="pipeline/new*/process">
<map:act type="request">
<map:parameter id="140" name="parameters" value="true"/>
<map:aggregate id="141" element="page">
<map:part id="142" src="cocoon:/component/menu/main"
element="layout-leftbar"/>
<map:part id="143"
src="cocoon:/component/addElement/{siteName}/sitemap.xmap"
element="layout-content"/>
</map:aggregate>
<map:transform id="144" src="stylesheets/layout.2.xsl"/>
<map:serialize id="145"/>
</map:act>
</map:match>
<!-- Pipeline Add New Element Results -->
<map:match id="146" pattern="pipeline/new*/success">
<map:act type="request">
<map:parameter id="147" name="parameters" value="true"/>
<map:redirect-to id="148"
uri="../../pipeline/edit/?siteName={siteName}&pipelineId={pipelineId}"/>
</map:act>
</map:match>
<map:match id="149" pattern="pipeline/new*/failure">
<map:act type="request">
<map:parameter id="150" name="parameters" value="true"/>
<map:redirect-to id="151"
uri="../../pipeline/edit/?siteName={siteName}&pipelineId={pipelineId}"/>
</map:act>
</map:match>
<!-- Pipeline Delete Element Processor -->
<map:match id="152" pattern="pipeline/deleteElement/process">
<map:act type="request">
<map:parameter id="153" name="parameters" value="true"/>
<map:aggregate id="154" element="page">
<map:part id="155" src="cocoon:/component/menu/main"
element="layout-leftbar"/>
<map:part id="156"
src="cocoon:/component/deleteElement/{elementId}/{siteName}/sitemap.xmap"
element="layout-content"/>
</map:aggregate>
<map:transform id="157" src="stylesheets/layout.2.xsl"/>
<map:serialize id="158"/>
</map:act>
</map:match>
<!-- Pipeline Delete Element Results -->
<map:match id="159" pattern="pipeline/deleteElement/success">
<map:act type="request">
<map:parameter id="160" name="parameters" value="true"/>
<map:redirect-to id="161"
uri="../../pipeline/edit/?siteName={siteName}&pipelineId={pipelineId}"/>
</map:act>
</map:match>
<map:match id="162" pattern="sitemap/deleteElement/failure">
<map:act type="request">
<map:parameter id="163" name="parameters" value="true"/>
<map:redirect-to id="164"
uri="../../pipeline/edit/?siteName={siteName}&pipelineId={pipelineId}"/>
</map:act>
</map:match>
<!-- Match Edit -->
<map:match id="165" pattern="match/edit/">
<map:act type="request">
<map:parameter id="166" name="parameters" value="true"/>
<map:aggregate id="167" element="page">
<map:part id="168" src="cocoon:/component/menu/main"
element="layout-leftbar"/>
<map:part id="169"
src="cocoon:/component/match/edit/{matchId}/{pipelineId}/{siteName}/"
element="layout-content"/>
</map:aggregate>
<map:transform id="170" src="stylesheets/layout.2.xsl"/>
<map:serialize id="171"/>
</map:act>
</map:match>
<!-- Match Add New Element Form -->
<map:match id="172" pattern="match/new*/">
<map:act type="request">
<map:parameter id="173" name="parameters" value="true"/>
<map:aggregate id="174" element="page">
<map:part id="175" src="cocoon:/component/menu/main"
element="layout-leftbar"/>
<map:part id="176"
src="cocoon:/component/form/newMatch{../1}/aggregateId={aggregateId}:matchId={matchId}:pipelineId={pipelineId}:siteName={siteName}/"
element="layout-content"/>
</map:aggregate>
<map:transform id="177" src="stylesheets/layout.2.xsl"/>
<map:serialize id="178"/>
</map:act>
</map:match>
<!-- Match Add New Element Processor -->
<map:match id="179" pattern="match/new*/process">
<map:act type="request">
<map:parameter id="180" name="parameters" value="true"/>
<map:aggregate id="181" element="page">
<map:part id="182" src="cocoon:/component/menu/main"
element="layout-leftbar"/>
<map:part id="183"
src="cocoon:/component/addElement/{siteName}/sitemap.xmap"
element="layout-content"/>
</map:aggregate>
<map:transform id="184" src="stylesheets/layout.2.xsl"/>
<map:serialize id="185"/>
</map:act>
</map:match>
<!-- Match Add New Element Results -->
<map:match id="186" pattern="match/new*/success">
<map:act type="request">
<map:parameter id="187" name="parameters" value="true"/>
<map:redirect-to id="188"
uri="../../match/edit/?siteName={siteName}&pipelineId={pipelineId}&matchId={matchId}"/>
</map:act>
</map:match>
<map:match id="189" pattern="match/new*/failure">
<map:act type="request">
<map:parameter id="190" name="parameters" value="true"/>
<map:redirect-to id="191"
uri="../../match/edit/?siteName={siteName}&pipelineId={pipelineId}&matchId={matchId}"/>
</map:act>
</map:match>
<!-- Match Delete Element Processor -->
<map:match id="192" pattern="match/deleteElement/process">
<map:act type="request">
<map:parameter id="193" name="parameters" value="true"/>
<map:aggregate id="194" element="page">
<map:part id="195" src="cocoon:/component/menu/main"
element="layout-leftbar"/>
<map:part id="196"
src="cocoon:/component/deleteElement/{elementId}/{siteName}/sitemap.xmap"
element="layout-content"/>
</map:aggregate>
<map:transform id="197" src="stylesheets/layout.2.xsl"/>
<map:serialize id="198"/>
</map:act>
</map:match>
<!-- Match Delete Element Results -->
<map:match id="199" pattern="match/deleteElement/success">
<map:act type="request">
<map:parameter id="200" name="parameters" value="true"/>
<map:redirect-to id="201"
uri="../../match/edit/?siteName={siteName}&pipelineId={pipelineId}&matchId={matchId}"/>
</map:act>
</map:match>
<map:match id="202" pattern="sitemap/deleteElement/failure">
<map:act type="request">
<map:parameter id="203" name="parameters" value="true"/>
<map:redirect-to id="204"
uri="../../match/edit/?siteName={siteName}&pipelineId={pipelineId}&matchId={matchId}"/>
</map:act>
</map:match>
<!-- Static Pages -->
<map:match id="205" type="regexp" pattern="(.*)/staticPage/(.*)">
<map:aggregate id="206" element="page">
<map:part id="207" src="component/staticFile/{2}"
element="layout-content"/>
</map:aggregate>
<map:transform id="208" src="stylesheets/layout.2.xsl"/>
<map:serialize id="209"/>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/datasources/addElement.jsp
Index: addElement.jsp
===================================================================
<%@ page language='java' session='false' %>
<%@ include file="cocoon_prefix.jspinclude" %>
<operation>
<%
// Generate followup URLs. This is the minimum needed to provide some valid
result.
// If this fails, it will fail with an ugly Cocoon exception
String successFollowupURI;
String failureFollowupURI;
{
StringBuffer followupQueryStringBuffer = new StringBuffer();
String queryStringSeparator = "?";
for (java.util.Enumeration e = request.getParameterNames() ;
e.hasMoreElements() ;) {
String parameterName = (String) e.nextElement();
if (parameterName.startsWith("followup_") &&
request.getParameter(parameterName)!=null &&
request.getParameter(parameterName).length()>0 ) {
followupQueryStringBuffer.append(queryStringSeparator);
followupQueryStringBuffer.append(parameterName.substring(9));
followupQueryStringBuffer.append("=");
followupQueryStringBuffer.append(request.getParameter(parameterName));
queryStringSeparator="&";
}
}
successFollowupURI =
(request.getParameter("successURI")==null?"success":request.getParameter("successURI"))
+ followupQueryStringBuffer.toString();
failureFollowupURI =
(request.getParameter("failureURI")==null?"failure":request.getParameter("failureURI"))
+ followupQueryStringBuffer.toString();
}
try {
// Since input and output are the same file, the input
// would get truncated when the output gets opened.
// Sitemaps are not very large, so we'll just read
// the whole thing into memory.
String sitemap;
String sitemapFilename = cocoonPrefix + request.getParameter("siteName") +
"/sitemap.xmap";
{
// sitemapReader is the sitemap file
java.io.FileReader sitemapReader = new
java.io.FileReader(sitemapFilename);
// sitemapWriter will construct a string representation of the sitemap
file contents
java.io.StringWriter sitemapWriter = new java.io.StringWriter();
// Read the whole thing into memory
int lastReadChar = sitemapReader.read();
while (lastReadChar != -1) {
sitemapWriter.write(lastReadChar);
lastReadChar = sitemapReader.read();
}
// Extract the string representation of the sitemap file
sitemap = sitemapWriter.toString();
// Clean up
sitemapWriter.close();
sitemapReader.close();
}
// Now we build the transformation from the input parameters
// This XSLT file will append a new element named after the value of
parameter 'elementName'
// to the element identified by the XPath expression in parameter
'parentElementXPath'
// Parameters attribute_<postfix> will generate attributes for the new
element. The attributes
// will be named after the postfix of the parameter, and its value is
contained on the parameter.
StringBuffer tb = new StringBuffer();
tb.append("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>"
);
tb.append(" <xsl:stylesheet version=\"1.0\" "
);
tb.append(" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\""
);
tb.append(" xmlns:map=\"http://apache.org/cocoon/sitemap/1.0\""
);
tb.append(" >"
);
tb.append(" <xsl:include href=\"" + cocoonPrefix +
"sitebuilder/stylesheets/sitemapEditHelper.xsl\" />");
tb.append(" <xsl:template match=\"" +
request.getParameter("parentElementXPath") + "\">"
);
tb.append(" <xsl:copy>"
);
tb.append(" <xsl:apply-templates select=\"@*|node()\"/> "
);
tb.append(" <" + request.getParameter("elementName"));
for (java.util.Enumeration e = request.getParameterNames() ;
e.hasMoreElements() ;) {
String parameterName = (String) e.nextElement();
if (parameterName.startsWith("attribute_") &&
request.getParameter(parameterName)!=null &&
request.getParameter(parameterName).length()>0 ) {
tb.append(" " + parameterName.substring(10) + "=\"" +
request.getParameter(parameterName) + "\""
);
}
}
tb.append(" >"
);
tb.append(" <xsl:call-template name=\"emitNextElementId\" />");
tb.append(" </" + request.getParameter("elementName") + ">"
);
tb.append(" </xsl:copy> "
);
tb.append(" </xsl:template>"
);
//tb.append(" <xsl:template match=\"" +
request.getParameter("parentElementXPath") +"/" +
request.getParameter("elementName") + "\">" );
//tb.append(" </xsl:template>"
);
tb.append(" </xsl:stylesheet>"
);
String transformation = tb.toString();
java.io.PrintWriter outPrintWriter = new java.io.PrintWriter(new
java.io.FileWriter(sitemapFilename));
javax.xml.transform.TransformerFactory tFactory =
javax.xml.transform.TransformerFactory.newInstance();
// Get the XML input document and the stylesheet, both in the servlet
// engine document directory.
javax.xml.transform.Source xmlSource =
new javax.xml.transform.stream.StreamSource
(new java.io.StringReader(sitemap));
javax.xml.transform.Source xslSource =
new javax.xml.transform.stream.StreamSource
(new java.io.StringReader(transformation));
// Generate the transformer.
javax.xml.transform.Transformer transformer =
tFactory.newTransformer(xslSource);
// Perform the transformation, sending the outPrintWriterput to the
response.
transformer.transform(xmlSource,
new
javax.xml.transform.stream.StreamResult(outPrintWriter));
%>
<result type="success" redirect="<%=successFollowupURI %>" />
<%
} catch (Exception e) {
%>
<result type="failure" redirect="<%=failureFollowupURI %>" >
<stacktrace>
<%
e.printStackTrace(new java.io.PrintWriter(out));
%>
</stacktrace>
</result>
<%
}
%>
</operation>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/datasources/cocoon_prefix.jspinclude
Index: cocoon_prefix.jspinclude
===================================================================
<%
// Get the location of the cocoon directory
String cocoonPrefix = config.getServletContext().getRealPath("/");
%>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/datasources/deleteElement.jsp
Index: deleteElement.jsp
===================================================================
<%@ page language='java' session='false' %>
<%@ include file="cocoon_prefix.jspinclude" %>
<operation>
<%
// Generate followup URLs. This is the minimum needed to provide some valid
result.
// If this fails, it will fail with an ugly Cocoon exception
String successFollowupURI;
String failureFollowupURI;
{
StringBuffer followupQueryStringBuffer = new StringBuffer();
String queryStringSeparator = "?";
for (java.util.Enumeration e = request.getParameterNames() ;
e.hasMoreElements() ;) {
String parameterName = (String) e.nextElement();
if (parameterName.startsWith("followup_") &&
request.getParameter(parameterName)!=null &&
request.getParameter(parameterName).length()>0 ) {
followupQueryStringBuffer.append(queryStringSeparator);
followupQueryStringBuffer.append(parameterName.substring(9));
followupQueryStringBuffer.append("=");
followupQueryStringBuffer.append(request.getParameter(parameterName));
queryStringSeparator="&";
}
}
successFollowupURI =
(request.getParameter("successURI")==null?"success":request.getParameter("successURI"))
+ followupQueryStringBuffer.toString();
failureFollowupURI =
(request.getParameter("failureURI")==null?"failure":request.getParameter("failureURI"))
+ followupQueryStringBuffer.toString();
}
try {
// Since input and output are the same file, the input
// would get truncated when the output gets opened.
// Sitemaps are not very large, so we'll just read
// the whole thing into memory.
String sitemap;
String sitemapFilename = cocoonPrefix + request.getParameter("siteName") +
"/sitemap.xmap";
{
// sitemapReader is the sitemap file
java.io.FileReader sitemapReader = new
java.io.FileReader(sitemapFilename);
// sitemapWriter will construct a string representation of the sitemap
file contents
java.io.StringWriter sitemapWriter = new java.io.StringWriter();
// Read the whole thing into memory
int lastReadChar = sitemapReader.read();
while (lastReadChar != -1) {
sitemapWriter.write(lastReadChar);
lastReadChar = sitemapReader.read();
}
// Extract the string representation of the sitemap file
sitemap = sitemapWriter.toString();
// Clean up
sitemapWriter.close();
sitemapReader.close();
}
StringBuffer tb = new StringBuffer();
tb.append("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>"
);
tb.append(" <xsl:stylesheet version=\"1.0\" "
);
tb.append(" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\""
);
tb.append(" xmlns:map=\"http://apache.org/cocoon/sitemap/1.0\""
);
tb.append(" >"
);
tb.append(" <xsl:include
href=\"sitebuilder/stylesheets/sitemapEditHelper.xsl\" />");
tb.append(" <xsl:template match=\"[EMAIL PROTECTED]" +
request.getParameter("elementId") + "]\" /> ");
tb.append(" </xsl:stylesheet>"
);
String transformation = tb.toString();
java.io.PrintWriter dbgPrintWriter = new java.io.PrintWriter(new
java.io.FileWriter("/tmp/debug.xsl"));
dbgPrintWriter.println(transformation);
dbgPrintWriter.close();
java.io.PrintWriter outPrintWriter = new java.io.PrintWriter(new
java.io.FileWriter(sitemapFilename));
javax.xml.transform.TransformerFactory tFactory =
javax.xml.transform.TransformerFactory.newInstance();
// Get the XML input document and the stylesheet, both in the servlet
// engine document directory.
javax.xml.transform.Source xmlSource =
new javax.xml.transform.stream.StreamSource
(new java.io.StringReader(sitemap));
javax.xml.transform.Source xslSource =
new javax.xml.transform.stream.StreamSource
(new java.io.StringReader(transformation));
// Generate the transformer.
javax.xml.transform.Transformer transformer =
tFactory.newTransformer(xslSource);
// Perform the transformation, sending the outPrintWriterput to the
response.
transformer.transform(xmlSource,
new
javax.xml.transform.stream.StreamResult(outPrintWriter));
%>
<result type="success" redirect="<%=successFollowupURI %>" />
<%
} catch (Exception e) {
%>
<result type="failure" redirect="<%=failureFollowupURI %>" >
<stacktrace>
<%
e.printStackTrace(new java.io.PrintWriter(out));
%>
</stacktrace>
</result>
<%
}
%>
</operation>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/datasources/menu.main.xml
Index: menu.main.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<critical:menu
xmlns:critical="http://www.criticalsoftware.com/NAMESPACES/CRITICAL/V1">
<!--
<critical:channel name="" image="" link="">
<critical:item title="" link="" />
</critical:channel>
-->
<critical:channel name="Menu">
<critical:item title="Open site" link="/cocoon/sitebuilder/" />
</critical:channel>
</critical:menu>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/datasources/forms/newMatchAggregate.xfdl
Index: newMatchAggregate.xfdl
===================================================================
<?xml version="1.0"?>
<XFDL version="4.0.1">
<page sid="newMatch">
<label>Add Aggregate to Match</label>
<field sid="followup_siteName">
<visible>off</visible>
<value>{siteName}</value>
</field>
<field sid="followup_pipelineId">
<visible>off</visible>
<value>{pipelineId}</value>
</field>
<field sid="followup_matchId">
<visible>off</visible>
<value>{matchId}</value>
</field>
<field sid="elementName">
<visible>off</visible>
<value>map:aggregate</value>
</field>
<field sid="parentElementXPath">
<visible>off</visible>
<value>//[EMAIL PROTECTED]</value>
</field>
<field sid="siteName">
<label>Site:</label>
<editstate>readonly</editstate>
<value>{siteName}</value>
</field>
<field sid="pipelineId">
<label>Pipeline:</label>
<editstate>readonly</editstate>
<value>{pipelineId}</value>
</field>
<field sid="matchId">
<label>Match:</label>
<editstate>readonly</editstate>
<value>{matchId}</value>
</field>
<field sid="attribute_element">
<label>Aggregate under element:</label>
<value></value>
</field>
<field sid="attribute_ns">
<label>Namespace:</label>
<value></value>
</field>
<button sid="submit_button">
<value>Process Form</value>
<type>done</type>
<url content="array">
<ae>process</ae>
</url>
</button>
</page>
</XFDL>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/datasources/forms/newMatchGenerate.xfdl
Index: newMatchGenerate.xfdl
===================================================================
<?xml version="1.0"?>
<XFDL version="4.0.1">
<page sid="newMatch">
<label>Add Generate to Match</label>
<field sid="followup_siteName">
<visible>off</visible>
<value>{siteName}</value>
</field>
<field sid="followup_pipelineId">
<visible>off</visible>
<value>{pipelineId}</value>
</field>
<field sid="followup_matchId">
<visible>off</visible>
<value>{matchId}</value>
</field>
<field sid="elementName">
<visible>off</visible>
<value>map:generate</value>
</field>
<field sid="parentElementXPath">
<visible>off</visible>
<value>//[EMAIL PROTECTED]</value>
</field>
<field sid="siteName">
<label>Site:</label>
<editstate>readonly</editstate>
<value>{siteName}</value>
</field>
<field sid="pipelineId">
<label>Pipeline:</label>
<editstate>readonly</editstate>
<value>{pipelineId}</value>
</field>
<field sid="matchId">
<label>Match:</label>
<editstate>readonly</editstate>
<value>{matchId}</value>
</field>
<field sid="attribute_type">
<label>Generator Type:</label>
<value></value>
</field>
<field sid="attribute_src">
<label>Source:</label>
<value></value>
</field>
<button sid="submit_button">
<value>Process Form</value>
<type>done</type>
<url content="array">
<ae>process</ae>
</url>
</button>
</page>
</XFDL>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/datasources/forms/newMatchGeneratePart.xfdl
Index: newMatchGeneratePart.xfdl
===================================================================
<?xml version="1.0"?>
<XFDL version="4.0.1">
<page sid="newMatch">
<label>Add Part to Aggregate</label>
<field sid="followup_siteName">
<visible>off</visible>
<value>{siteName}</value>
</field>
<field sid="followup_pipelineId">
<visible>off</visible>
<value>{pipelineId}</value>
</field>
<field sid="followup_matchId">
<visible>off</visible>
<value>{matchId}</value>
</field>
<field sid="elementName">
<visible>off</visible>
<value>map:part</value>
</field>
<field sid="parentElementXPath">
<visible>off</visible>
<value>//[EMAIL PROTECTED]</value>
</field>
<field sid="siteName">
<label>Site:</label>
<editstate>readonly</editstate>
<value>{siteName}</value>
</field>
<field sid="pipelineId">
<label>Pipeline:</label>
<editstate>readonly</editstate>
<value>{pipelineId}</value>
</field>
<field sid="matchId">
<label>Match:</label>
<editstate>readonly</editstate>
<value>{matchId}</value>
</field>
<field sid="attribute_src">
<label>Source URI:</label>
<value></value>
</field>
<field sid="attribute_element">
<label>Root Element:</label>
<value></value>
</field>
<field sid="attribute_ns">
<label>Namespace:</label>
<value></value>
</field>
<button sid="submit_button">
<value>Process Form</value>
<type>done</type>
<url content="array">
<ae>process</ae>
</url>
</button>
</page>
</XFDL>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/datasources/forms/newMatchRead.xfdl
Index: newMatchRead.xfdl
===================================================================
<?xml version="1.0"?>
<XFDL version="4.0.1">
<page sid="newMatch">
<label>Add Generate to Match</label>
<field sid="followup_siteName">
<visible>off</visible>
<value>{siteName}</value>
</field>
<field sid="followup_pipelineId">
<visible>off</visible>
<value>{pipelineId}</value>
</field>
<field sid="followup_matchId">
<visible>off</visible>
<value>{matchId}</value>
</field>
<field sid="elementName">
<visible>off</visible>
<value>map:read</value>
</field>
<field sid="parentElementXPath">
<visible>off</visible>
<value>//[EMAIL PROTECTED]</value>
</field>
<field sid="siteName">
<label>Site:</label>
<editstate>readonly</editstate>
<value>{siteName}</value>
</field>
<field sid="pipelineId">
<label>Pipeline:</label>
<editstate>readonly</editstate>
<value>{pipelineId}</value>
</field>
<field sid="matchId">
<label>Match:</label>
<editstate>readonly</editstate>
<value>{matchId}</value>
</field>
<field sid="attribute_type">
<label>Reader Type:</label>
<value></value>
</field>
<field sid="attribute_src">
<label>Source:</label>
<value></value>
</field>
<field sid="attribute_mime-type">
<label>Mime type:</label>
<value></value>
</field>
<button sid="submit_button">
<value>Process Form</value>
<type>done</type>
<url content="array">
<ae>process</ae>
</url>
</button>
</page>
</XFDL>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/datasources/forms/newMatchSerialize.xfdl
Index: newMatchSerialize.xfdl
===================================================================
<?xml version="1.0"?>
<XFDL version="4.0.1">
<page sid="newMatch">
<label>Add Generate to Match</label>
<field sid="followup_siteName">
<visible>off</visible>
<value>{siteName}</value>
</field>
<field sid="followup_pipelineId">
<visible>off</visible>
<value>{pipelineId}</value>
</field>
<field sid="followup_matchId">
<visible>off</visible>
<value>{matchId}</value>
</field>
<field sid="elementName">
<visible>off</visible>
<value>map:serialize</value>
</field>
<field sid="parentElementXPath">
<visible>off</visible>
<value>//[EMAIL PROTECTED]</value>
</field>
<field sid="siteName">
<label>Site:</label>
<editstate>readonly</editstate>
<value>{siteName}</value>
</field>
<field sid="pipelineId">
<label>Pipeline:</label>
<editstate>readonly</editstate>
<value>{pipelineId}</value>
</field>
<field sid="matchId">
<label>Match:</label>
<editstate>readonly</editstate>
<value>{matchId}</value>
</field>
<field sid="attribute_type">
<label>Serializer Type:</label>
<value></value>
</field>
<button sid="submit_button">
<value>Process Form</value>
<type>done</type>
<url content="array">
<ae>process</ae>
</url>
</button>
</page>
</XFDL>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/datasources/forms/newMatchTransform.xfdl
Index: newMatchTransform.xfdl
===================================================================
<?xml version="1.0"?>
<XFDL version="4.0.1">
<page sid="newMatch">
<label>Add Generate to Match</label>
<field sid="followup_siteName">
<visible>off</visible>
<value>{siteName}</value>
</field>
<field sid="followup_pipelineId">
<visible>off</visible>
<value>{pipelineId}</value>
</field>
<field sid="followup_matchId">
<visible>off</visible>
<value>{matchId}</value>
</field>
<field sid="elementName">
<visible>off</visible>
<value>map:transform</value>
</field>
<field sid="parentElementXPath">
<visible>off</visible>
<value>//[EMAIL PROTECTED]</value>
</field>
<field sid="siteName">
<label>Site:</label>
<editstate>readonly</editstate>
<value>{siteName}</value>
</field>
<field sid="pipelineId">
<label>Pipeline:</label>
<editstate>readonly</editstate>
<value>{pipelineId}</value>
</field>
<field sid="matchId">
<label>Match:</label>
<editstate>readonly</editstate>
<value>{matchId}</value>
</field>
<field sid="attribute_type">
<label>Transformer Type:</label>
<value></value>
</field>
<field sid="attribute_src">
<label>Source:</label>
<value></value>
</field>
<button sid="submit_button">
<value>Process Form</value>
<type>done</type>
<url content="array">
<ae>process</ae>
</url>
</button>
</page>
</XFDL>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/datasources/forms/newPipelineMatch.xfdl
Index: newPipelineMatch.xfdl
===================================================================
<?xml version="1.0"?>
<XFDL version="4.0.1">
<page sid="newMatch">
<label>Add Match to Pipeline</label>
<field sid="followup_siteName">
<visible>off</visible>
<value>{siteName}</value>
</field>
<field sid="followup_pipelineId">
<visible>off</visible>
<value>{pipelineId}</value>
</field>
<field sid="elementName">
<visible>off</visible>
<value>map:match</value>
</field>
<field sid="parentElementXPath">
<visible>off</visible>
<value>//[EMAIL PROTECTED]</value>
</field>
<field sid="siteName">
<label>Site:</label>
<editstate>readonly</editstate>
<value>{siteName}</value>
</field>
<field sid="pipelineId">
<label>Pipeline:</label>
<editstate>readonly</editstate>
<value>{pipelineId}</value>
</field>
<field sid="attribute_type">
<label>Match Type:</label>
<value></value>
</field>
<field sid="attribute_pattern">
<label>Match Pattern:</label>
<value></value>
</field>
<button sid="submit_button">
<value>Process Form</value>
<type>done</type>
<url content="array">
<ae>process</ae>
</url>
</button>
</page>
</XFDL>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/datasources/forms/newSitemapAction.xfdl
Index: newSitemapAction.xfdl
===================================================================
<?xml version="1.0"?>
<XFDL version="4.0.1">
<page sid="newAction">
<label>Add Action to Sitemap</label>
<field sid="followup_siteName">
<visible>off</visible>
<value>{siteName}</value>
</field>
<field sid="elementName">
<visible>off</visible>
<value>map:action</value>
</field>
<field sid="parentElementXPath">
<visible>off</visible>
<value>/map:sitemap/map:components/map:actions</value>
</field>
<field sid="siteName">
<label>Generator's Site:</label>
<editstate>readonly</editstate>
<value>{siteName}</value>
</field>
<field sid="attribute_name">
<label>Action Name:</label>
<value></value>
</field>
<field sid="attribute_src">
<label>Action Java Class:</label>
<value></value>
</field>
<button sid="submit_button">
<value>Process Form</value>
<type>done</type>
<url content="array">
<ae>process</ae>
</url>
</button>
</page>
</XFDL>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/datasources/forms/newSitemapGenerator.xfdl
Index: newSitemapGenerator.xfdl
===================================================================
<?xml version="1.0"?>
<XFDL version="4.0.1">
<page sid="newGenerator">
<label>Add Generator to Sitemap</label>
<field sid="followup_siteName">
<visible>off</visible>
<value>{siteName}</value>
</field>
<field sid="elementName">
<visible>off</visible>
<value>map:generator</value>
</field>
<field sid="parentElementXPath">
<visible>off</visible>
<value>/map:sitemap/map:components/map:generators</value>
</field>
<field sid="siteName">
<label>Generator's Site:</label>
<editstate>readonly</editstate>
<value>{siteName}</value>
</field>
<field sid="attribute_name">
<label>Generator Name:</label>
<value></value>
</field>
<field sid="attribute_src">
<label>Generator Java Class:</label>
<value></value>
</field>
<field sid="attribute_label">
<label>Generator Label:</label>
<value></value>
</field>
<button sid="submit_button">
<value>Process Form</value>
<type>done</type>
<url content="array">
<ae>process</ae>
</url>
</button>
</page>
</XFDL>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/datasources/forms/newSitemapMatcher.xfdl
Index: newSitemapMatcher.xfdl
===================================================================
<?xml version="1.0"?>
<XFDL version="4.0.1">
<page sid="newMatcher">
<label>Add Matcher to Sitemap</label>
<field sid="followup_siteName">
<visible>off</visible>
<value>{siteName}</value>
</field>
<field sid="elementName">
<visible>off</visible>
<value>map:matcher</value>
</field>
<field sid="parentElementXPath">
<visible>off</visible>
<value>/map:sitemap/map:components/map:matchers</value>
</field>
<field sid="siteName">
<label>Generator's Site:</label>
<editstate>readonly</editstate>
<value>{siteName}</value>
</field>
<field sid="attribute_name">
<label>Matcher Name:</label>
<value></value>
</field>
<field sid="attribute_src">
<label>Matcher Java Class:</label>
<value></value>
</field>
<button sid="submit_button">
<value>Process Form</value>
<type>done</type>
<url content="array">
<ae>process</ae>
</url>
</button>
</page>
</XFDL>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/datasources/forms/newSitemapPipeline.xfdl
Index: newSitemapPipeline.xfdl
===================================================================
<?xml version="1.0"?>
<XFDL version="4.0.1">
<page sid="newPipeline">
<label>Add Pipeline to Sitemap</label>
<field sid="followup_siteName">
<visible>off</visible>
<value>{siteName}</value>
</field>
<field sid="elementName">
<visible>off</visible>
<value>map:pipeline</value>
</field>
<field sid="parentElementXPath">
<visible>off</visible>
<value>/map:sitemap/map:pipelines</value>
</field>
<field sid="siteName">
<label>Generator's Site:</label>
<editstate>readonly</editstate>
<value>{siteName}</value>
</field>
<button sid="submit_button">
<value>Process Form</value>
<type>done</type>
<url content="array">
<ae>process</ae>
</url>
</button>
</page>
</XFDL>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/datasources/forms/newSitemapReader.xfdl
Index: newSitemapReader.xfdl
===================================================================
<?xml version="1.0"?>
<XFDL version="4.0.1">
<page sid="newTransformer">
<label>Add Transformer to Sitemap</label>
<field sid="followup_siteName">
<visible>off</visible>
<value>{siteName}</value>
</field>
<field sid="elementName">
<visible>off</visible>
<value>map:reader</value>
</field>
<field sid="parentElementXPath">
<visible>off</visible>
<value>/map:sitemap/map:components/map:readers</value>
</field>
<field sid="siteName">
<label>Reader's Site:</label>
<editstate>readonly</editstate>
<value>{siteName}</value>
</field>
<field sid="attribute_name">
<label>Reader Name:</label>
<value></value>
</field>
<field sid="attribute_src">
<label>Reader Java Class:</label>
<value></value>
</field>
<button sid="submit_button">
<value>Process Form</value>
<type>done</type>
<url content="array">
<ae>process</ae>
</url>
</button>
</page>
</XFDL>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/datasources/forms/newSitemapSelector.xfdl
Index: newSitemapSelector.xfdl
===================================================================
<?xml version="1.0"?>
<XFDL version="4.0.1">
<page sid="newSelector">
<label>Add Selector to Sitemap</label>
<field sid="followup_siteName">
<visible>off</visible>
<value>{siteName}</value>
</field>
<field sid="elementName">
<visible>off</visible>
<value>map:selector</value>
</field>
<field sid="parentElementXPath">
<visible>off</visible>
<value>/map:sitemap/map:components/map:selectors</value>
</field>
<field sid="siteName">
<label>Generator's Site:</label>
<editstate>readonly</editstate>
<value>{siteName}</value>
</field>
<field sid="attribute_name">
<label>Selector Name:</label>
<value></value>
</field>
<field sid="attribute_src">
<label>Selector Java Class:</label>
<value></value>
</field>
<button sid="submit_button">
<value>Process Form</value>
<type>done</type>
<url content="array">
<ae>process</ae>
</url>
</button>
</page>
</XFDL>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/datasources/forms/newSitemapSerializer.xfdl
Index: newSitemapSerializer.xfdl
===================================================================
<?xml version="1.0"?>
<XFDL version="4.0.1">
<page sid="newTransformer">
<label>Add Transformer to Sitemap</label>
<field sid="followup_siteName">
<visible>off</visible>
<value>{siteName}</value>
</field>
<field sid="elementName">
<visible>off</visible>
<value>map:serializer</value>
</field>
<field sid="parentElementXPath">
<visible>off</visible>
<value>/map:sitemap/map:components/map:serializers</value>
</field>
<field sid="siteName">
<label>Serializer's Site:</label>
<editstate>readonly</editstate>
<value>{siteName}</value>
</field>
<field sid="attribute_name">
<label>Serializer Name:</label>
<value></value>
</field>
<field sid="attribute_mime-type">
<label>Serializer mime-type:</label>
<value></value>
</field>
<field sid="attribute_src">
<label>Serializer Java Class:</label>
<value></value>
</field>
<button sid="submit_button">
<value>Process Form</value>
<type>done</type>
<url content="array">
<ae>process</ae>
</url>
</button>
</page>
</XFDL>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/datasources/forms/newSitemapTransformer.xfdl
Index: newSitemapTransformer.xfdl
===================================================================
<?xml version="1.0"?>
<XFDL version="4.0.1">
<page sid="newTransformer">
<label>Add Transformer to Sitemap</label>
<field sid="followup_siteName">
<visible>off</visible>
<value>{siteName}</value>
</field>
<field sid="elementName">
<visible>off</visible>
<value>map:transformer</value>
</field>
<field sid="parentElementXPath">
<visible>off</visible>
<value>/map:sitemap/map:components/map:transformers</value>
</field>
<field sid="siteName">
<label>Generator's Site:</label>
<editstate>readonly</editstate>
<value>{siteName}</value>
</field>
<field sid="attribute_name">
<label>Transformer Name:</label>
<value></value>
</field>
<field sid="attribute_src">
<label>Transformer Java Class:</label>
<value></value>
</field>
<button sid="submit_button">
<value>Process Form</value>
<type>done</type>
<url content="array">
<ae>process</ae>
</url>
</button>
</page>
</XFDL>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/staticContent/openSite.html
Index: openSite.html
===================================================================
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Sitebuilder</title>
</head>
<body>
<div align="Center">
<h1>Sitebuilder</h1>
</div>
<div align="Left">To start using sitebuilder, please type the name of the
site you want to edit, and submit the form:<br>
<b>Site name:</b>
<form action="sitemap/view/" method="get"><input type="text"
name="siteName"><input type="submit" value="Open"></form>
<hr width="60%" size="1" noshade=""><br>
<div align="Center">©2001, <a href="mailto:[EMAIL PROTECTED]">
Sérgio Carvalho</a>
. All rights reserved<br>
</div>
</div>
</body>
</html>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/staticContent/sitebuilder.css
Index: sitebuilder.css
===================================================================
* /* Base properties */
{
font-family: Verdana, sans-serif;
font-size: 12pt;
background-color: white;
}
/* ---- Links ---- */
A:link /* unvisited links */
{
text-decoration: underline
}
A:visited /* visited links */
{
text-decoration: underline;
}
A:hover /* user hovers */
{
text-decoration: none;
}
A:active /* active links */
{
text-decoration: none;
}
/* ---- /Links ---- */
/* ---- Main Menu ----*/
table.sitebuilder_mainMenu
{
width: 100%;
border: none;
margin: 0mm;
padding: 0mm;
}
*.sitebuilder_mainMenuHeader
{
font-family: Arial, sans-serif;
font-size: 10pt;
font-weight: bold;
background-color: #000099;
text-align: center;
color: white;
}
*.sitebuilder_mainMenuItem
{
font-family: Arial, sans-serif;
font-size: 10pt;
font-weight: bold;
text-align: center;
background-color: #ededff;
}
/* ---- /Main Menu ---- */
/* ---- Sitemap View --- */
table.sitebuilder_sitemapView
{
width: 100%;
border: none;
margin: 0mm;
padding: 0mm;
}
*.sitebuilder_sitemapViewTitle
{
font-family: Arial, sans-serif;
font-size: 14pt;
text-align: center;
background-color: #000099;
color: white;
width: 80%;
}
*.sitebuilder_sitemapViewEdit
{
font-family: Arial, sans-serif;
font-size: 10pt;
text-align: right;
background-color: #000099;
color: #000099;
}
A.sitebuilder_sitemapViewEdit
{
font-family: Arial, sans-serif;
font-size: 10pt;
text-align: right;
background-color: #000099;
color: #AAFFFF;
}
*.sitebuilder_sitemapViewPartTitle
{
font-family: Arial, sans-serif;
font-size: 10pt;
font-weight: bold;
text-align: center;
background-color: #000099;
color: white;
}
*.sitebuilder_sitemapViewPartList
{
font-family: Verdana, sans-serif;
font-size: 12pt;
background-color: white;
}
*.sitebuilder_aggregateParts
{
margin-left: 2em;
}
*.sitebuilder_error
{
color: red;
font-weight: bold;
}
/* ---- /Sitemap View --- */
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/stylesheets/fragmentExtractor.xsl
Index: fragmentExtractor.xsl
===================================================================
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:param name="elementId" />
<xsl:template match="/">
<xsl:apply-templates select="//[EMAIL PROTECTED]"/>
</xsl:template>
<xsl:template match="@*|*|text()|processing-instruction()" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/stylesheets/layout.2.xsl
Index: layout.2.xsl
===================================================================
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<!-- Match The Root Node -->
<xsl:template match="page">
<HTML>
<HEAD>
<TITLE>Sitebuilder</TITLE>
<link rel="stylesheet"
href="/cocoon/sitebuilder/staticFile/sitebuilder.css" type="text/css" />
</HEAD>
<BODY bgcolor="white">
<center>
<table width="700" align="center"
bgcolor="#FFFFFF" name="t_corpo"
cellpadding="5" cellspacing="5"
border="0" vspace="0"
hspace="0"
>
<TR>
<td valign="top" align="center" width="80">
<xsl:apply-templates select="layout-leftbar"/>
</td>
<td width="580" bgcolor="#FFFFFF" valign="top">
<xsl:apply-templates select="layout-content"/>
</td>
</TR>
</table>
</center>
</BODY>
</HTML>
</xsl:template>
<!-- Match page components -->
<xsl:template match="layout-leftbar|layout-content">
<xsl:apply-templates/>
</xsl:template>
<!-- Copy non-positioning markup -->
<xsl:template match="@*|*|text()|processing-instruction()"
priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/stylesheets/match.edit.xsl
Index: match.edit.xsl
===================================================================
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
Author: Sergio Carvalho "[EMAIL PROTECTED]"
Changelog:
First release:
Description:
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<xsl:param name="siteName" />
<xsl:param name="pipelineId" />
<xsl:param name="matchId" />
<xsl:template match="map:match">
<table class="sitebuilder_sitemapView">
<tr>
<td class="sitebuilder_sitemapViewTitle">Edit Match for "
<em class="sitebuilder_sitemapViewTitle">
<xsl:value-of select="@pattern" />
</em>
"</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit">
<xsl:attribute
name="href">/cocoon/sitebuilder/pipeline/edit/?siteName=<xsl:value-of
select="$siteName" />&pipelineId=<xsl:value-of select="$pipelineId"
/></xsl:attribute>
[Edit Pipeline]</a>
<br />
</td>
</tr>
<tr>
<td class="sitebuilder_sitemapViewPartTitle">Generator</td>
<td class="sitebuilder_sitemapViewEdit">
<xsl:if
test="count(map:generate)+count(map:read)+count(map:aggregate) = 0">
<a class="sitebuilder_sitemapViewEdit">
<xsl:attribute
name="href">/cocoon/sitebuilder/match/newAggregate/?siteName=<xsl:value-of
select="$siteName" />&pipelineId=<xsl:value-of select="$pipelineId"
/>&matchId=<xsl:value-of select="$matchId" /></xsl:attribute>
[Add Aggregation]</a>
<br />
<a class="sitebuilder_sitemapViewEdit">
<xsl:attribute
name="href">/cocoon/sitebuilder/match/newGenerate/?siteName=<xsl:value-of
select="$siteName" />&pipelineId=<xsl:value-of select="$pipelineId"
/>&matchId=<xsl:value-of select="$matchId" /></xsl:attribute>
[Add Generator]</a>
<br />
<a class="sitebuilder_sitemapViewEdit">
<xsl:attribute
name="href">/cocoon/sitebuilder/match/newRead/?siteName=<xsl:value-of
select="$siteName" />&pipelineId=<xsl:value-of select="$pipelineId"
/>&matchId=<xsl:value-of select="$matchId" /></xsl:attribute>
[Add Reader]</a>
<br />
</xsl:if>
</td>
</tr>
<xsl:call-template name="generator_edit" />
<xsl:if test="count(map:read) = 0">
<tr>
<td class="sitebuilder_sitemapViewPartTitle">Transformers</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit">
<xsl:attribute
name="href">/cocoon/sitebuilder/match/newTransform/?siteName=<xsl:value-of
select="$siteName" />&pipelineId=<xsl:value-of select="$pipelineId"
/>&matchId=<xsl:value-of select="$matchId" /></xsl:attribute>
[Add]</a>
<br />
</td>
</tr>
<xsl:apply-templates select="map:transform" />
<tr>
<td class="sitebuilder_sitemapViewPartTitle">Serializer</td>
<td class="sitebuilder_sitemapViewEdit">
<xsl:if test="count(map:serialize) = 0">
<a class="sitebuilder_sitemapViewEdit">
<xsl:attribute
name="href">/cocoon/sitebuilder/match/newSerialize/?siteName=<xsl:value-of
select="$siteName" />&pipelineId=<xsl:value-of select="$pipelineId"
/>&matchId=<xsl:value-of select="$matchId" /></xsl:attribute>
[Add]</a>
<br />
</xsl:if>
</td>
</tr>
<xsl:call-template name="serializer_edit" />
</xsl:if>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewTitle">End of Match
Description</td>
</tr>
</table>
</xsl:template>
<xsl:template name="generator_edit">
<xsl:choose>
<xsl:when test="count(map:generate|map:read|map:aggregate) > 0">
<xsl:apply-templates select="map:generate|map:read|map:aggregate" />
</xsl:when>
<xsl:otherwise>
<tr>
<td class="sitebuilder_sitemapViewPartList">
<div class="sitebuilder_error">No Generator defined! Please click
add to define it.</div>
</td>
<td class="sitebuilder_sitemapViewEdit">
</td>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="serializer_edit">
<xsl:choose>
<xsl:when test="count(map:serialize) > 0">
<xsl:apply-templates select="map:serialize" />
</xsl:when>
<xsl:otherwise>
<tr>
<td class="sitebuilder_sitemapViewPartList">
<div class="sitebuilder_error">No Serializer defined! Please
click add to define it.</div>
</td>
<td class="sitebuilder_sitemapViewEdit">
</td>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="map:aggregate">
<tr>
<td class="sitebuilder_sitemapViewPartList">
Aggregation under <em><<xsl:if test="@ns"><xsl:value-of
select="@ns" />:</xsl:if><xsl:value-of select="@element" />></em> of:
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/match/deleteElement/process?siteName=<xsl:value-of
select="$siteName" />&elementId=<xsl:value-of select="@id"
/>&followup_siteName=<xsl:value-of select="$siteName"
/>&followup_pipelineId=<xsl:value-of select="$pipelineId"
/>&followup_matchId=<xsl:value-of select="$matchId"
/></xsl:attribute>[Remove]</a><br/>
<a class="sitebuilder_sitemapViewEdit">
<xsl:attribute
name="href">/cocoon/sitebuilder/match/newGeneratePart/?siteName=<xsl:value-of
select="$siteName" />&pipelineId=<xsl:value-of select="$pipelineId"
/>&matchId=<xsl:value-of select="$matchId" />&aggregateId=<xsl:value-of
select="@id" /></xsl:attribute>
[Add Part]</a>
<br />
</td>
</tr>
<xsl:apply-templates select="map:part" />
</xsl:template>
<xsl:template match="map:part">
<tr>
<td class="sitebuilder_sitemapViewPartList">
<div class="sitebuilder_aggregateParts"><xsl:value-of select="@src" />
under <xsl:if test="@ns">'<xsl:value-of select="@ns"
/>':</xsl:if><em><<xsl:value-of select="@element" />></em></div>
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/match/deleteElement/process?siteName=<xsl:value-of
select="$siteName" />&elementId=<xsl:value-of select="@id"
/>&followup_siteName=<xsl:value-of select="$siteName"
/>&followup_pipelineId=<xsl:value-of select="$pipelineId"
/>&followup_matchId=<xsl:value-of select="$matchId"
/></xsl:attribute>[Remove]</a><br/>
</td>
</tr>
</xsl:template>
<xsl:template match="map:read">
<tr>
<td class="sitebuilder_sitemapViewPartList">
Reader for <xsl:value-of select="@src" />
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/match/deleteElement/process?siteName=<xsl:value-of
select="$siteName" />&elementId=<xsl:value-of select="@id"
/>&followup_siteName=<xsl:value-of select="$siteName"
/>&followup_pipelineId=<xsl:value-of select="$pipelineId"
/>&followup_matchId=<xsl:value-of select="$matchId"
/></xsl:attribute>[Remove]</a><br/>
</td>
</tr>
</xsl:template>
<xsl:template match="map:generate">
<tr>
<td class="sitebuilder_sitemapViewPartList">
<xsl:choose>
<xsl:when test="@type">
<xsl:value-of select="@type" />
</xsl:when>
<xsl:otherwise>
<em>default</em>
</xsl:otherwise>
</xsl:choose>
@
<xsl:value-of select="@src" />
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/match/deleteElement/process?siteName=<xsl:value-of
select="$siteName" />&elementId=<xsl:value-of select="@id"
/>&followup_siteName=<xsl:value-of select="$siteName"
/>&followup_pipelineId=<xsl:value-of select="$pipelineId"
/>&followup_matchId=<xsl:value-of select="$matchId"
/></xsl:attribute>[Remove]</a><br/>
</td>
</tr>
</xsl:template>
<xsl:template match="map:transform">
<tr>
<td class="sitebuilder_sitemapViewPartList">
<xsl:choose>
<xsl:when test="@type">
<xsl:value-of select="@type" />
</xsl:when>
<xsl:otherwise>
<em>default</em>
</xsl:otherwise>
</xsl:choose>
@
<xsl:value-of select="@src" />
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/match/deleteElement/process?siteName=<xsl:value-of
select="$siteName" />&elementId=<xsl:value-of select="@id"
/>&followup_siteName=<xsl:value-of select="$siteName"
/>&followup_pipelineId=<xsl:value-of select="$pipelineId"
/>&followup_matchId=<xsl:value-of select="$matchId"
/></xsl:attribute>[Remove]</a><br/>
</td>
</tr>
</xsl:template>
<xsl:template match="map:serialize">
<tr>
<td class="sitebuilder_sitemapViewPartList">
<xsl:choose>
<xsl:when test="@type">
<xsl:value-of select="@type" />
</xsl:when>
<xsl:otherwise>
<em>default</em>
</xsl:otherwise>
</xsl:choose>
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/match/deleteElement/process?siteName=<xsl:value-of
select="$siteName" />&elementId=<xsl:value-of select="@id"
/>&followup_siteName=<xsl:value-of select="$siteName"
/>&followup_pipelineId=<xsl:value-of select="$pipelineId"
/>&followup_matchId=<xsl:value-of select="$matchId"
/></xsl:attribute>[Remove]</a><br/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/stylesheets/menu.main.xsl
Index: menu.main.xsl
===================================================================
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
Author: Sergio Carvalho "[EMAIL PROTECTED]"
Changelog:
First version: 2000/12/21
First release: 2000/12/30
Description: Sub-stylesheet handling the main menu content part of a page.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:critical="http://www.criticalsoftware.com/NAMESPACES/CRITICAL/V1"
>
<xsl:template match="critical:menu">
<table class="sitebuilder_mainMenu">
<xsl:apply-templates/>
<tr height="4"><td/></tr>
</table>
</xsl:template>
<xsl:template match="critical:menu//critical:channel">
<tr class="sitebuilder_mainMenu">
<td height="4"/>
</tr>
<tr>
<!-- bgcolor="#000099" align="center" -->
<td class="sitebuilder_mainMenuHeader">
<xsl:value-of select="@name"/>
</td>
</tr>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="critical:menu//critical:item">
<tr>
<!-- <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif"
size="-2" color="#330066"><b> -->
<td class="sitebuilder_mainMenuItem" height="4"><a
class="sitebuilder_mainMenuItem"><xsl:attribute name="href"><xsl:value-of
select="@link"/></xsl:attribute><xsl:value-of select="@title"/></a></td>
</tr>
</xsl:template>
</xsl:stylesheet>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/stylesheets/operation-result.xsl
Index: operation-result.xsl
===================================================================
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:map="http://apache.org/cocoon/sitemap/1.0"
>
<xsl:template match="/">
<div>
<p>Please wait while operation executes...</p>
<xsl:apply-templates />
</div>
</xsl:template>
<xsl:template match="[EMAIL PROTECTED]'success']">
<p>Operation executed successfully</p>
<p>Please click
<a>
<xsl:attribute name="href"><xsl:value-of
select="@redirect"/></xsl:attribute>
here
</a>
to proceed</p>
<script language="javascript">document.location="<xsl:value-of
select="@redirect"/>"</script>
</xsl:template>
<xsl:template match="[EMAIL PROTECTED]'failure']">
<p>Operation failed</p>
<p>Please click
<a>
<xsl:attribute name="href"><xsl:value-of
select="@redirect"/></xsl:attribute>
here
</a>
to proceed</p>
<hr/>
<p>Exception stack trace</p>
<xsl:value-of select="stacktrace" />
</xsl:template>
</xsl:stylesheet>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/stylesheets/pipeline.edit.xsl
Index: pipeline.edit.xsl
===================================================================
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
Author: Sergio Carvalho "[EMAIL PROTECTED]"
Changelog:
First release:
Description: Sub-stylesheet to present a Cocoon 2 sitemap.xmap file in HTML.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:map="http://apache.org/cocoon/sitemap/1.0"
>
<xsl:param name="siteName" />
<xsl:param name="pipelineId" />
<xsl:template match="map:pipeline">
<table class="sitebuilder_sitemapView">
<tr>
<td class="sitebuilder_sitemapViewTitle">
Edit Pipeline
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/sitemap/edit/?siteName=<xsl:value-of
select="$siteName" /></xsl:attribute>[Edit Sitemap]
</a><br />
</td>
</tr>
<tr>
<td class="sitebuilder_sitemapViewPartTitle">
Matches
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/pipeline/newMatch/?siteName=<xsl:value-of
select="$siteName" />&pipelineId=<xsl:value-of select="$pipelineId"
/></xsl:attribute>[Add]</a><br />
</td>
</tr>
<xsl:apply-templates select="map:match" />
<tr>
<td colspan="2" class="sitebuilder_sitemapViewTitle">
End of Pipeline Description
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="map:match">
<tr>
<td class="sitebuilder_sitemapViewPartList">
Match for <em>"<xsl:value-of select="@pattern" />"</em>
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/pipeline/deleteElement/process?siteName=<xsl:value-of
select="$siteName" />&elementId=<xsl:value-of select="@id"
/>&followup_siteName=<xsl:value-of select="$siteName"
/>&followup_pipelineId=<xsl:value-of select="$pipelineId"
/></xsl:attribute>[Remove]</a><br/>
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/match/edit/?siteName=<xsl:value-of
select="$siteName" />&pipelineId=<xsl:value-of select="$pipelineId"
/>&matchId=<xsl:value-of select="@id" /></xsl:attribute>[Edit]</a><br />
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/stylesheets/replacer.xsp
Index: replacer.xsp
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
This page produces a set of nitf data elements, from a database.
The elements are contained within a critical:news element
Parameters:
nitfTable - Table where nitf stories are contained.
nitfSection - Section of stories to retrieve.
nitfId - ID of the story to retrieve. Optional; if missing, all
stories in the section are returned.
-->
<xsp:page
language="java"
xmlns:xsp="http://apache.org/xsp"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:stylesheet version="1.0">
<xsp:logic>
String urlEncodedToReplace = parameters.getParameter("toReplace","");
java.util.Enumeration searchReplacePairs = new
java.util.StringTokenizer(urlEncodedToReplace, ":");
while (searchReplacePairs.hasMoreElements()) {
String searchReplacePair = (String) searchReplacePairs.nextElement();
int separator = searchReplacePair.indexOf("=");
String search = searchReplacePair.substring(0,separator);
String replace = searchReplacePair.substring(separator + 1);
<xsp:content>
<xsl:template><xsp:attribute
name="match">text()[contains(string(.),'{<xsp:expr>search</xsp:expr>}')]</xsp:attribute><xsl:value-of>
<xsp:attribute
name="select">substring-before(string(.),'{<xsp:expr>search</xsp:expr>}')</xsp:attribute>
</xsl:value-of><xsp:expr>replace</xsp:expr><xsl:value-of><xsp:attribute
name="select">substring-after(string(.),'{<xsp:expr>search</xsp:expr>}')</xsp:attribute></xsl:value-of></xsl:template>
</xsp:content>
}
</xsp:logic>
<xsl:template match="@*|*|text()|processing-instruction()" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
</xsp:page>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/stylesheets/simple-page2html.xsl
Index: simple-page2html.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="view-source"/>
<xsl:template match="page">
<html>
<head>
<title>
<xsl:value-of select="title"/>
</title>
</head>
<body bgcolor="white" alink="red" link="blue" vlink="blue">
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="title">
<h2 style="color: navy; text-align: center">
<xsl:if test="not($view-source)">
<xsl:apply-templates/>
</xsl:if>
<xsl:if test="$view-source">
<A>
<xsl:attribute name="HREF">../view-source?filename=/<xsl:value-of
select="$view-source"/></xsl:attribute>
<xsl:attribute name="TARGET">_blank</xsl:attribute>
<xsl:apply-templates/>
</A>
</xsl:if>
</h2>
</xsl:template>
<xsl:template match="para">
<p align="left">
<i><xsl:apply-templates/></i>
</p>
</xsl:template>
</xsl:stylesheet>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/stylesheets/sitemap.edit.xsl
Index: sitemap.edit.xsl
===================================================================
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
Author: Sergio Carvalho "[EMAIL PROTECTED]"
Changelog:
First release:
Description: Sub-stylesheet to present a Cocoon 2 sitemap.xmap file in HTML.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:map="http://apache.org/cocoon/sitemap/1.0"
>
<xsl:param name="siteName" />
<xsl:template match="map:sitemap">
<table class="sitebuilder_sitemapView">
<tr>
<td class="sitebuilder_sitemapViewTitle">
Edit Sitemap
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/sitemap/view/?siteName=<xsl:value-of
select="$siteName" /></xsl:attribute>[View]
</a><br />
</td>
</tr>
<tr>
<td class="sitebuilder_sitemapViewPartTitle">
Generators
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/sitemap/newGenerator/?siteName=<xsl:value-of
select="$siteName" /></xsl:attribute>[Add]
</a><br />
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartList">
<xsl:apply-templates
select="map:components/map:generators/map:generator" />
</td>
</tr>
<tr>
<td class="sitebuilder_sitemapViewPartTitle">
Transformers
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/sitemap/newTransformer/?siteName=<xsl:value-of
select="$siteName" /></xsl:attribute>[Add]
</a><br />
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartList">
<xsl:apply-templates
select="map:components/map:transformers/map:transformer" />
</td>
</tr>
<tr>
<td class="sitebuilder_sitemapViewPartTitle">
Readers
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/sitemap/newReader/?siteName=<xsl:value-of
select="$siteName" /></xsl:attribute>[Add]</a><br />
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartList">
<xsl:apply-templates select="map:components/map:readers/map:reader" />
</td>
</tr>
<tr>
<td class="sitebuilder_sitemapViewPartTitle">
Serializers
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/sitemap/newSerializer/?siteName=<xsl:value-of
select="$siteName" /></xsl:attribute>[Add]</a><br />
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartList">
<xsl:apply-templates
select="map:components/map:serializers/map:serializer" />
</td>
</tr>
<tr>
<td class="sitebuilder_sitemapViewPartTitle">
Selectors
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/sitemap/newSelector/?siteName=<xsl:value-of
select="$siteName" /></xsl:attribute>[Add]</a><br />
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartList">
<xsl:apply-templates select="map:components/map:selectors/map:selector"
/>
</td>
</tr>
<tr>
<td class="sitebuilder_sitemapViewPartTitle">
Matchers
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/sitemap/newMatcher/?siteName=<xsl:value-of
select="$siteName" /></xsl:attribute>[Add]</a><br />
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartList">
<xsl:apply-templates select="map:components/map:matchers/map:matcher" />
</td>
</tr>
<tr>
<td class="sitebuilder_sitemapViewPartTitle">
Actions
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/sitemap/newAction/?siteName=<xsl:value-of
select="$siteName" /></xsl:attribute>[Add]</a><br />
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartList">
<xsl:apply-templates select="map:components/map:actions/map:action" />
</td>
</tr>
<tr>
<td class="sitebuilder_sitemapViewPartTitle">
Pipelines
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/sitemap/newPipeline/?siteName=<xsl:value-of
select="$siteName" /></xsl:attribute>[Add]</a><br />
</td>
</tr>
<xsl:apply-templates select="map:pipelines/map:pipeline" />
<tr>
<td colspan="2" class="sitebuilder_sitemapViewTitle">
End of Sitemap Description
</td>
</tr>
</table>
</xsl:template>
<xsl:template
match="map:generator|map:transformer|map:reader|map:serializer|map:selector|map:matcher|map:action">
<xsl:choose>
<xsl:when test="@name=../@default">
<b><xsl:value-of select="@name" /></b><br />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name" /><br />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="map:pipeline">
<tr>
<td class="sitebuilder_sitemapViewPartList">
Pipeline <xsl:value-of select="position()" />
<xsl:if test="@internal-only"> (Internal Pipeline)</xsl:if>
<br/>
<div style="margin-left: 2em">
<xsl:apply-templates select="map:match" />
</div>
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/sitemap/deleteElement/process?siteName=<xsl:value-of
select="$siteName" />&elementId=<xsl:value-of select="@id"
/>&followup_siteName=<xsl:value-of select="$siteName"
/></xsl:attribute>[Remove]</a><br/>
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/pipeline/edit/?siteName=<xsl:value-of
select="$siteName" />&pipelineId=<xsl:value-of select="@id"
/></xsl:attribute>[Edit]</a><br />
</td>
</tr>
</xsl:template>
<xsl:template match="map:match">
Matches: "<i><xsl:value-of select="@pattern" /></i>"<br/>
</xsl:template>
</xsl:stylesheet>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/stylesheets/sitemap.openSubSite.xsl
Index: sitemap.openSubSite.xsl
===================================================================
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
Author: Sergio Carvalho "[EMAIL PROTECTED]"
Changelog:
First release:
Description: Sub-stylesheet to present a Cocoon 2 sitemap.xmap file in HTML.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:map="http://apache.org/cocoon/sitemap/1.0"
>
<xsl:param name="siteName" />
<xsl:template match="/">
<table class="sitebuilder_sitemapView">
<tr>
<td colspan="2" class="sitebuilder_sitemapViewTitle">
Open Site
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartTitle">
Sitemaps
</td>
</tr>
<xsl:apply-templates select="descendant::map:mount" />
</table>
</xsl:template>
<xsl:template match="map:mount">
<tr>
<td class="sitebuilder_sitemapViewPartList">
<xsl:value-of select="substring-before(@uri-prefix,'/')" />
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/sitemap/view/?siteName=<xsl:value-of
select="$siteName" /><xsl:value-of select="substring-before(@src,'/')"
/></xsl:attribute>[Open]
</a>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/stylesheets/sitemap.view.xsl
Index: sitemap.view.xsl
===================================================================
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
Author: Sergio Carvalho "[EMAIL PROTECTED]"
Changelog:
First release:
Description: Sub-stylesheet to present a Cocoon 2 sitemap.xmap file in HTML.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:map="http://apache.org/cocoon/sitemap/1.0"
>
<xsl:param name="siteName" />
<xsl:template match="map:sitemap">
<table class="sitebuilder_sitemapView">
<tr>
<td class="sitebuilder_sitemapViewTitle">
View Sitemap
</td>
<td class="sitebuilder_sitemapViewEdit">
<a class="sitebuilder_sitemapViewEdit"><xsl:attribute
name="href">/cocoon/sitebuilder/sitemap/edit/?siteName=<xsl:value-of
select="$siteName" /></xsl:attribute>[Edit]
</a>
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartTitle">
Generators
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartList">
<xsl:apply-templates
select="map:components/map:generators/map:generator" />
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartTitle">
Transformers
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartList">
<xsl:apply-templates
select="map:components/map:transformers/map:transformer" />
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartTitle">
Readers
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartList">
<xsl:apply-templates select="map:components/map:readers/map:reader" />
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartTitle">
Serializers
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartList">
<xsl:apply-templates
select="map:components/map:serializers/map:serializer" />
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartTitle">
Selectors
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartList">
<xsl:apply-templates select="map:components/map:selectors/map:selector"
/>
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartTitle">
Matchers
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartList">
<xsl:apply-templates select="map:components/map:matchers/map:matcher" />
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartTitle">
Actions
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartList">
<xsl:apply-templates select="map:components/map:actions/map:action" />
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartTitle">
Pipelines
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewPartList">
<xsl:apply-templates select="map:pipelines/map:pipeline" />
</td>
</tr>
<tr>
<td colspan="2" class="sitebuilder_sitemapViewTitle">
End of Sitemap Description
</td>
</tr>
</table>
</xsl:template>
<xsl:template
match="map:generator|map:transformer|map:reader|map:serializer|map:selector|map:matcher|map:action">
<xsl:choose>
<xsl:when test="@name=../@default">
<b><xsl:value-of select="@name" /></b><br />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name" /><br />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="map:pipeline">
Pipeline <xsl:value-of select="position()" />
<xsl:if test="@internal-only"> (Internal Pipeline)</xsl:if>
<br/>
<div style="margin-left: 2em">
<xsl:apply-templates select="map:match" />
</div>
</xsl:template>
<xsl:template match="map:match">
Matches: "<i><xsl:value-of select="@pattern" /></i>"<br/>
</xsl:template>
</xsl:stylesheet>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/stylesheets/sitemapEditHelper.xsl
Index: sitemapEditHelper.xsl
===================================================================
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:variable name="nextElementId"><xsl:value-of
select="count(/descendant::node()/@id) + 1" /></xsl:variable>
<xsl:template name="emitNextElementId">
<xsl:attribute name="id"><xsl:value-of select="$nextElementId"
/></xsl:attribute>
</xsl:template>
<xsl:template match="@*|*|text()|processing-instruction()" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/stylesheets/staticSnippet.xsl
Index: staticSnippet.xsl
===================================================================
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="staticSnippetTarget">/</xsl:param>
<xsl:param name="staticSnippetWidth">100</xsl:param>
<xsl:param name="staticSnippetHeight">100</xsl:param>
<!-- Match The Root Node -->
<xsl:template match="dummy">
<iframe scrolling="no" frameborder="0" marginwidth="0" marginheheight="0">
<xsl:attribute name="src"><xsl:value-of select="$staticSnippetTarget"
/></xsl:attribute>
<xsl:attribute name="width"><xsl:value-of select="$staticSnippetWidth"
/></xsl:attribute>
<xsl:attribute name="height"><xsl:value-of select="$staticSnippetHeight"
/></xsl:attribute>
[Destaque Portugalmail]
</iframe>
</xsl:template>
</xsl:stylesheet>
1.1
xml-cocoon2/src/scratchpad/webapp/samples/sitebuilder/stylesheets/xfdl-html.xsl
Index: xfdl-html.xsl
===================================================================
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<!-- Entry template. This template can be matched or called. -->
<!-- XFDL mode is set on every other template to speed processing -->
<!-- and avoid conflicts. -->
<xsl:template match="XFDL" name="xfdl.XFDL">
<form method="post">
<!-- The form action is that of the first submit button. -->
<!-- Without DOM handling, HTML forms can't be submitted -->
<!-- to several URLs. -->
<xsl:attribute name="action"><xsl:value-of select="page/button[type='done'
or type='submit'][1]/url/*[1]" /></xsl:attribute>
<xsl:apply-templates mode="XFDL" />
</form>
</xsl:template>
<!-- ** XFDL mode templates ** -->
<!-- bgcolor option -->
<xsl:template match="bgcolor" mode="XFDL" />
<!-- Page -->
<xsl:template match="page" mode="XFDL">
<div>
<table cellpadding="0" cellspacing="0" border="0">
<xsl:apply-templates mode="XFDL-page" />
</table>
</div>
</xsl:template>
<!-- ** XFDL-page mode templates ** -->
<!-- bgcolor option -->
<xsl:template match="bgcolor" mode="XFDL-page" />
<xsl:template match="label" mode="XFDL-page">
<tr>
<td colspan="2">
<xsl:value-of select="text()" />
</td>
</tr>
</xsl:template>
<!-- Field Item -->
<xsl:template match="field" mode="XFDL-page">
<xsl:choose>
<xsl:when test="visible='off' or visible='false'">
<input type="hidden">
<xsl:attribute name="name"><xsl:value-of select="@sid" /></xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="value"
/></xsl:attribute>
</input>
</xsl:when>
<xsl:otherwise>
<tr>
<td>
<xsl:value-of select="label" />
</td>
<td>
<xsl:choose>
<xsl:when test="editstate='readonly'"><xsl:value-of select="value" />
<input type="hidden">
<xsl:attribute name="name"><xsl:value-of select="@sid"
/></xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="value"
/></xsl:attribute>
</input>
</xsl:when>
<xsl:otherwise>
<input>
<xsl:attribute name="name"><xsl:value-of select="@sid"
/></xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="value"
/></xsl:attribute>
</input>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Button Item -->
<xsl:template match="button" mode="XFDL-page">
<tr>
<td colspan="2">
<input type="submit">
<xsl:if test="@value"><xsl:attribute name="value"><xsl:value-of
select="@value" /></xsl:attribute></xsl:if>
</input>
</td>
</tr>
</xsl:template>
<!-- XFDL requires us to pass on non-XFDL markup -->
<xsl:template name="XFDL-copy-template">
<xsl:copy>
<xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|*|text()|processing-instruction()" priority="-1"
mode="XFDL">
<xsl:call-template name="XFDL-copy-template" />
</xsl:template>
<xsl:template match="@*|*|text()|processing-instruction()" priority="-1"
mode="XFDL-page">
<xsl:call-template name="XFDL-copy-template" />
</xsl:template>
<xsl:template match="@*|*|text()|processing-instruction()" priority="-1"
mode="XFDL-item">
<xsl:call-template name="XFDL-copy-template" />
</xsl:template>
</xsl:stylesheet>
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]