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!

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, 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.



Sjur