Glad 2 see your problem is solved... I also had some issues in this trend as well when I started out with Cocoon2.2. So that's why I expected it would be something like this.
Cheers, Robby -----Original Message----- From: JeVeoy [mailto:[email protected]] Sent: Friday, November 13, 2009 7:48 PM To: [email protected] Subject: RE: Cocoon 2.2 serialize/transform only parts of XSL content I got only one word for you, Robby, and that's: YES!! First I checked out all 5 .js-files in a browser with the address you mentioned. They were displayed correctly. So I jumped to your next suggestion and changed serialize type to html. I got some errors when I did this (trimmed stacktrace for readability): ---------------------------------------------------------------- org.apache.cocoon.ProcessingException: Failed to process pipeline Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cocoon.serialization.Serializer/htmlPooled': Initialization of bean failed; nested exception is java.lang.ExceptionInInitializerError Caused by: org.apache.cocoon.components.serializers.encoding.CharsetFactory$Charset FactoryException: Unable to load charsets because their classes are not present ---------------------------------------------------------------- Then I removed the serializing declaration from map:components, returning to plain default behaviour and *voila*...works like a charm! Changes made to the previous script (if someone wonders about this later on): sitemap.xmap <!-- Components --> <map:components> <map:matchers default="wildcard"/> <map:selectors default="browser"/> <map:generators default="file"/> <map:transformers default="xslt"/> <map:readers default="resource"/> <map:serializers default="html"/> </map:components> <map:match pattern="*.xml" internal-only="true"> <map:generate type="jx" src="templates/{1}.xml"/> <map:transform src="styles/transformations/page.xslt"/> <map:serialize type="html"/> </map:match> page.xslt Removed dummy function (no longer needed to display javascript) Thank you so incredible much!!!!! Best regards, JeVeoy Robby Pelssers-3 wrote: > > A few things for you to test... > - if you try out the pattern **.js ... can you open the corresponding > .js file? Should be something like > http://localhost:8888/{myblock}/js/jquery.js > > > - Check if using the html serializer solves your problem > <map:match pattern="*.xml" internal-only="true"> > <map:generate type="jx" src="templates/{1}.xml"/> > <map:transform src="styles/transformations/page.xslt"/> > <map:serialize type="html"/> > </map:match> > - Try adding a hard space in your xslt for including scripts > <xsl:for-each select="header/scripts/src"> > <xsl:variable name="jsSrc"><xsl:value-of > select="."/></xsl:variable> > <script src="js/{$jsSrc}"> </script> > </xsl:for-each> > > > If that still doesn't work let me know. > > Cheers, > Robby Pelssers > > -----Original Message----- > From: JeVeoy [mailto:[email protected]] > Sent: Thursday, November 12, 2009 3:21 PM > To: [email protected] > Subject: Cocoon 2.2 serialize/transform only parts of XSL content > > > I'm really not sure about the origin of this error (I'm kind-of newbie > to > Cocoon), but I've searched and tried so hard to fix this issue that I > don't > recognize the guy staring at me in the mirror... > > I'm using Cocoon 2.2 and have built an application according to > http://cocoon.apache.org/2.2/1159_1_1.html first Cocoon application > using > Maven 2 . So far so good. > > Then I wanted to add XSLT for transformation. This really didn't do the > trick for me. Right now I've downgraded my working example down to a > very > simple .xml-file for content ("index.xml"), a very simple .xslt-file for > transformation ("page.xslt") and of course a sitemap.xmap. > > What I want to achieve is to be able to define different .css- and > .js-files > in index.xml, load this in page.xslt and make sure sitemap.xmap process > it > accordingly. > > As of now only the first .js-file is processed. It doesn't matter if I > change which .js-files are included or the order of them. I've also > tried to > put 2 or more straight into the <head>-segment in page.xslt, but with > the > same result. I can see that all .js-files are sent to page.xslt (writing > out > values in a table). Here's the log4j console output: > > 2009-11-12 14:34:38,836 INFO '' Processed by Apache Cocoon in 33 > milliseconds. > 2009-11-12 14:34:38,876 INFO 'styles/css/style.css' Processed by Apache > Cocoon in 8 milliseconds. > 2009-11-12 14:34:38,896 INFO 'styles/css/navigation.css' Processed by > Apache > Cocoon in 20 milliseconds. > 2009-11-12 14:34:38,908 INFO 'js/jquery.js' Processed by Apache Cocoon > in 22 > milliseconds. > > When I check the source of the page only 1 out of 5 .js-files are > included > in the <head>-segment. > > Why? > > Could someone please help me? > > Sourcecode: > index.xml > <?xml version="1.0" encoding="UTF-8"?> > > <main_document> > <header> > <styles> > <css>style.css</css> > <css>navigation.css</css> > </styles> > <scripts> > <src>jquery.js</src> > <src>browser.js</src> > <src>resize.js</src> > <src>misc.js</src> > <src>mail.js</src> > </scripts> > </header> > </main_document> > > page.xslt > <?xml version="1.0" encoding="ISO-8859-1"?> > > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > <xsl:template match="main_document"> > <html> > <head> > <xsl:for-each select="header/styles/css"> > <xsl:variable name="styleCss"><xsl:value-of > select="."/></xsl:variable> > <link href="styles/css/{$styleCss}" rel="stylesheet" > type="text/css"/> > </xsl:for-each> > > <xsl:for-each select="header/scripts/src"> > <xsl:variable name="jsSrc"><xsl:value-of > select="."/></xsl:variable> > <script src="js/{$jsSrc}"></script> > </xsl:for-each> > > <!-- Had to include this to load body-segment. If not included I > got > "<body/>" (and no content) --> > <script language="JavaScript1.2"> > function dummy() { return 0; } > </script> > </head> > > <body> > <table> > <!-- This code will output 5 .js-files --> > <xsl:for-each select="header/scripts/src"> > <tr><td><xsl:value-of select="."/></td></tr> > </xsl:for-each> > </table> > </body> > </html> > </xsl:template> > </xsl:stylesheet> > > sitemap.xmap > <?xml version="1.0" encoding="UTF-8"?> > > <map:sitemap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://apache.org/cocoon/sitemap/1.0 > http://cocoon.apache.org/schema/sitemap/cocoon-sitemap-1.0.xsd" > xmlns:map="http://apache.org/cocoon/sitemap/1.0"> > <!-- Components --> > <map:components> > <map:matchers default="wildcard"/> > <map:selectors default="browser"/> > <map:generators default="file"/> > <map:transformers default="xslt"/> > <map:readers default="resource"/> > <map:serializers default="html"> > <map:serializer name="html" logger="sitemap.serializer.html" > mime-type="text/html; charset=utf-8" pool-grow="4" pool-max="32" > pool-min="4" > src="org.apache.cocoon.components.serializers.HTMLSerializer"> > <doctype-default>loose</doctype-default> > <encoding>UTF-8</encoding> > </map:serializer> > </map:serializers> > </map:components> > > <!-- Definition of the control flow implementation --> > <map:flow language="javascript"> > <map:script src="flow/event.js"/> > <map:script src="flow/jobs.js"/> > <map:script src="flow/session.js"/> > <map:script src="flow/show.js"/> > </map:flow> > > <map:pipelines> > <!-- Pipeline for "root", e.g. "localhost:8888/webapp/" --> > <map:pipeline> > <map:match pattern=""> > <map:call function="intercept"/> > </map:match> > > <!-- .kont URLs are generated by the Flow system for continuations > --> > <map:match pattern="*.kont"> > <map:call continuation="{1}"/> > </map:match> > > <map:match pattern="action_*"> > <map:call function="intercept"> > <map:parameter name="action" value="{1}"/> > </map:call> > </map:match> > > <map:match pattern="*.xml" internal-only="true"> > <map:generate type="jx" src="templates/{1}.xml"/> > <map:transform src="styles/transformations/page.xslt"/> > <map:serialize type="xhtml"/> > </map:match> > > <!-- Server --> > > <map:match pattern="**favicon.png"> > <map:read src="img/ico/favicon.png" > mime-type="application/png"/> > </map:match> > > <!-- Common --> > <map:match pattern="**.css"> > <map:read src="{1}.css" mime-type="text/css"/> > </map:match> > > <map:match pattern="**.js"> > <map:read src="{1}.js" mime-type="text/javascript"/> > </map:match> > > <map:match pattern="**.gif"> > <map:read src="img/{1}.gif" mime-type="image/gif"/> > </map:match> > > <map:match pattern="**.jpg"> > <map:read src="img/{1}.jpg" mime-type="image/jpg"/> > </map:match> > > <map:match pattern="**.png"> > <map:read src="img/{1}.png" mime-type="image/png"/> > </map:match> > > <!--<map:handle-errors> > <map:generate src="templates/error.xml"/> > <map:transform src="styles/transformations/page.xslt"/> > <map:serialize type="xhtml"/> > </map:handle-errors>--> > > </map:pipeline> > </map:pipelines> > </map:sitemap> > -- > View this message in context: > http://old.nabble.com/Cocoon-2.2-serialize-transform-only-parts-of-XSL-c > ontent-tp26319511p26319511.html > Sent from the Cocoon - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > -- View this message in context: http://old.nabble.com/Cocoon-2.2-serialize-transform-only-parts-of-XSL-c ontent-tp26319511p26341475.html Sent from the Cocoon - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
