On Fri, 2006-09-15 at 10:58 +0300, Sjur Moshagen wrote: > Den 15. sep. 2006 kl. 08.14 skrev Sjur Moshagen: > > > With the correction you made above, I get the same result as you - > > it works!
Nice work Gav and Sjur. > > > > Thanks so far, I will now continue with the next step. I'm certain > > I will be back with more questions soon:-) > > So here it comes:-) > > I got the simple version to work, now I would like to extract some > info based on the requested document. I thus changed the pelt.fv hook > to this: > > <forrest:hook class="languages"> > <forrest:contract name="language-variants" > dataURI="cocoon://#{$getRequest}.languages.xml"/> > </forrest:hook> > > Notice the @dataURI I've added. > > I *think* I understand what's going on - here's what I believe, > please verify or correct any misconception: > > - the dataURI is looked up separately, and the returned data is > served as an argument (XML snippet) to the contract, well to be 100% correct: if a dataURI is defined this src is used as the input doc to the xsl transformation (where the contract is the source for the xsl). The properties are parsed as parameter. If no dataURI is defined we create a <foo/> document in the dispatcher as input doc to trigger the transformation. > to do whatever > more is needed > > I have found matches for cocoon://**.title.xml, and copied it to my > local sitemap, and modified it: > > In src/documentation/sitemap.xmap: > > <map:pipeline> > <map:match pattern="**.languages.xml"> > <map:generate src="cocoon://{1}.xml" /> > <map:transform src="{lm:dataModel-xml-document-to- > languages.xsl}" /> > <map:serialize /> > </map:match> > </map:pipeline> > > This should give me the source document, which is transformed with > the specified stylesheet. I have the following in: > > src/documentation/resources/stylesheets/xslt/xml/document-to- > languages.xsl > > <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/ > Transform"> > <!-- Template to generate the document language --> > <xsl:template match="document"> > <xsl:choose> > <xsl:when test="@xml:lang"> > <xsl:copy-of select="@xml:lang"/> > </xsl:when> > <xsl:otherwise> > <title>*No* language found</title> > </xsl:otherwise> > </xsl:choose> > > </xsl:template> > </xsl:stylesheet> > > > which I think the locationmap should be able to resolv, based on the > following snippet in plugins/o.a.f.plugin.internal.dispatcher/ > locationmap.xml: > > <match pattern="dataModel-xml-document-to-**.xsl"> > <select type="exists"> > <location > src="{properties:resources}stylesheets/xslt/xml/ > document-to-{1}.xsl" > /> > <location > src="{lm:std-dataModel-xml-document-to-{1}.xsl}" > /> > </select> > </match> > > With all this, and without changing the contract from what was > working earlier, I get the following error: > > Internal Server Error > > Message: null > > Description: No details available. > > Sender: org.apache.cocoon.servlet.CocoonServlet > > Source: Cocoon Servlet > > Request URI > > index.html > cause > > dispatcherError: 500 - Internal server error > The contract "language-variants" has thrown thrown an exception by > resolving raw data from "cocoon://index.languages.xml". > > dispatcherErrorStack: > org.apache.excalibur.source.SourceException: Cannot get input > stream for cocoon://index.languages.xml > request-uri > > /index.html;jsessionid=3anfa8koll7k8 > Apache Cocoon 2.2.0-dev > > > > From what I can see, it isn't able to resolve the stylesheet OR the > source document for some reason. The source document: "org.apache.excalibur.source.SourceException: Cannot get input stream for cocoon://index.languages.xml" What does localhost:8888/index.languages.xml return (this will be the testing url for the next steps)? Reading the dispatcherError I guess it will return nothing. To debug what exactly cannot be found try: <map:pipeline> <map:match pattern="**.languages.xml"> <map:generate src="cocoon://{1}.xml" /> <map:serialize /> </map:match> </map:pipeline> If this returns the document then the xsl cannot be found. To verify put again the xsl into the pipe and see the log. There should be then an exception telling you where cocoon tried to get the xsl from. I normally do the cat ${exceptionLocation} and see what is gives, if it returns something then try <map:pipeline> <map:match pattern="**.languages.xml"> <map:generate src="{lm:dataModel-xml-document-to- languages.xsl}" /> <map:serialize /> </map:match> </map:pipeline> If this works then the xsl itself maybe corrupt. HTH salu2 -- Thorsten Scherler COO Spain Wyona Inc. - Open Source Content Management - Apache Lenya http://www.wyona.com http://lenya.apache.org [EMAIL PROTECTED] [EMAIL PROTECTED]