Author: bdelacretaz Date: Tue Oct 12 06:00:06 2004 New Revision: 54671 Added: cocoon/trunk/src/test/anteater/flowscript-dom-dump.xml cocoon/trunk/src/webapp/samples/test/flowscript-dom-dump/ cocoon/trunk/src/webapp/samples/test/flowscript-dom-dump/dom-dump.js cocoon/trunk/src/webapp/samples/test/flowscript-dom-dump/dom-dumper.jx.xml cocoon/trunk/src/webapp/samples/test/flowscript-dom-dump/explain-test.xml cocoon/trunk/src/webapp/samples/test/flowscript-dom-dump/sitemap.xmap cocoon/trunk/src/webapp/samples/test/flowscript-dom-dump/test-transform.xsl Log: changes ported from 2.1 branch for bugzilla 29381: JXTemplateGenerator uses IncludeXMLConsumer to remove start/endDocument events when dumping DOM objects
Added: cocoon/trunk/src/test/anteater/flowscript-dom-dump.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/test/anteater/flowscript-dom-dump.xml Tue Oct 12 06:00:06 2004 @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<project name="flowscript-dom-dump" default="flowscript-dom-dump"> + + <!-- + Check various ways of dumping DOM objects in Flowscript + (bugzilla 29381) + --> + <target name="flowscript-dom-dump"> + <property name="baseUrl" value="${anteater.env.cocoon}/samples/test/flowscript-dom-dump"/> + + <httpRequest href="${baseUrl}/dom-dump" description="Check dump without XSLT transform"> + <match> + <header name="Content-type" value="text/xml"/> + <xpath select="//dump-without-star/root/child" pattern="childText"/> + <xpath select="//dump-with-star/root/child" pattern="childText"/> + </match> + </httpRequest> + + <httpRequest href="${baseUrl}/dom-dump-xslt" description="Check dump with XSLT transform"> + <match> + <header name="Content-type" value="text/xml"/> + <xpath select="//dump-without-star/root/@test-transform" pattern="true"/> + <xpath select="//dump-without-star/root/child" pattern="childText"/> + <xpath select="//dump-with-star/root/@test-transform" pattern="true"/> + <xpath select="//dump-with-star/root/child" pattern="childText"/> + </match> + </httpRequest> + + </target> + +</project> Added: cocoon/trunk/src/webapp/samples/test/flowscript-dom-dump/dom-dump.js ============================================================================== --- (empty file) +++ cocoon/trunk/src/webapp/samples/test/flowscript-dom-dump/dom-dump.js Tue Oct 12 06:00:06 2004 @@ -0,0 +1,23 @@ +/* +* Copyright 1999-2004 The Apache Software Foundation +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +function dumpDomObject() { + var dom = Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); + var root = dom.appendChild(dom.createElement("root")); + var child = root.appendChild(dom.createElement("child")); + child.appendChild(dom.createTextNode("childText")); + cocoon.sendPage("dom-dump-pipeline", { "domObject" : dom }); +} Added: cocoon/trunk/src/webapp/samples/test/flowscript-dom-dump/dom-dumper.jx.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/webapp/samples/test/flowscript-dom-dump/dom-dumper.jx.xml Tue Oct 12 06:00:06 2004 @@ -0,0 +1,25 @@ +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<dom-dumper xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"> + <dump-without-star> + #{domObject} + </dump-without-star> + + <dump-with-star> + #{domObject/*} + </dump-with-star> +</dom-dumper> \ No newline at end of file Added: cocoon/trunk/src/webapp/samples/test/flowscript-dom-dump/explain-test.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/webapp/samples/test/flowscript-dom-dump/explain-test.xml Tue Oct 12 06:00:06 2004 @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- CVS $Id: explain-test.xml 30932 2004-07-29 17:35:38Z vgritsenko $ --> + +<page> + <title>flowscript-dom-dump test pages</title> + <content> + <para> + This is used by the flowscript-dom-dump anteater test + </para> + <para> + Test links: + <ul> + <li><link href="dom-dump">dump a DOM object, no transform</link></li> + <li><link href="dom-dump-xslt">dump a DOM object, followed by XSLT transform</link></li> + </ul> + </para> + </content> +</page> Added: cocoon/trunk/src/webapp/samples/test/flowscript-dom-dump/sitemap.xmap ============================================================================== --- (empty file) +++ cocoon/trunk/src/webapp/samples/test/flowscript-dom-dump/sitemap.xmap Tue Oct 12 06:00:06 2004 @@ -0,0 +1,46 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> + + <map:flow language="javascript"> + <map:script src="dom-dump.js"/> + </map:flow> + + <map:pipelines> + + + <!-- used by the internalRequest anteater test --> + <map:pipeline> + <map:match pattern="dom-dump"> + <map:call function="dumpDomObject"/> + </map:match> + + <map:match pattern="dom-dump-pipeline"> + <map:generate type="jx" src="dom-dumper.jx.xml"/> + <map:serialize type="xml"/> + </map:match> + + <map:match pattern="dom-dump-xslt"> + <map:generate src="cocoon:/dom-dump"/> + <map:transform src="test-transform.xsl"/> + <map:serialize type="xml"/> + </map:match> + + </map:pipeline> + + </map:pipelines> +</map:sitemap> Added: cocoon/trunk/src/webapp/samples/test/flowscript-dom-dump/test-transform.xsl ============================================================================== --- (empty file) +++ cocoon/trunk/src/webapp/samples/test/flowscript-dom-dump/test-transform.xsl Tue Oct 12 06:00:06 2004 @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- + Identity transform used to test bugzilla 29381 + CVS $Id: dir-links.xsl 30932 2004-07-29 17:35:38Z vgritsenko $ + --> + +<xsl:stylesheet + version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +> + <!-- by default copy everything --> + <xsl:template match="*"> + <xsl:copy> + <xsl:copy-of select="@*"/> + <xsl:apply-templates/> + </xsl:copy> + </xsl:template> + + <!-- let them know we were here --> + <xsl:template match="root"> + <root test-transform="true"> + <xsl:apply-templates/> + </root> + </xsl:template> +</xsl:stylesheet>
