Your pattern is "get-images/*", the url your request is "get-images". Drop the /* from you pattern and it will work...

And why not add the src attribute on the generate element? :)

Cheers

Hiral Parikh wrote:
 Hi Geert,
I am still having problems with just executing one more pattern in the
pipeline from my XSL sheet.
I get this error:
org.apache.avalon.framework.CascadingException: Resouce not found:
cocoon://appname/get-images

My stylesheet (checkImage.xsl):
<xsl:stylesheet ...>
        blah blah to get the node
   <xi:include src="cocoon:/get-images{.}"
xmlns:xi="http://www.w3.org/2001/XInclude"; parse="xml" />

My sitemap:
       <map:match pattern="test.xsl">
         <map:generate src="test.xml" type="file"/>
         <map:transform src="checkImage.xsl" type="xslt-saxon"/>
         <map:transform type="xinclude"/>
        <map:serialize type="xml"/>
       </map:match>

     <map:match pattern="get-images/*">
     <map:generate type="directory">
             <map:parameter name="src" value="{1}"/>
     </map:generate>
        <-- do nothing after this as we want to test the xi:include -->
          <map:serialize type="xml"/>
     </map:match>

Any idea what's going wrong? Am I doing the xi:include in a wrong way?

Thanks,
Hiral



-----Original Message-----
From: Geert Josten [mailto:[EMAIL PROTECTED] Sent: Friday, February 18, 2005 1:07 PM
To: [email protected]
Subject: Re: XSL File I/O



But for some reason it does not go to the sitemap pattern="get-image-url/*.jpg".
I renamed the pattern name in the sitemap to something else so that it does not match, just to check if the Cocoon throws any error. But no

error.

There might be a more greedy match before this one, or in a 'higher' sitemap
(= closer to webapp root dir).

Or could be that you just need to use ** instead of *?


I know that the XSL matches the template <xsl:template match="foo/@image-url"> as I am able to print some debug statements.
I tried <xi:include>,bu obviously it just inserted that line of code in the outcoming XML.


How can I transfer the control to Cocoon sitemap from the XSL and then get the XML inserted in the XSL?
In simple words:
<xsl:template match="foo/@image-url">
Go to Sitemap to match some pattern "get-image-url{.}"
Do the transformation Get the XML back in this XSL
Continue with transformation


Once again: most obvious option is document(), but because of the earlier
mentioned bug, you might not want to use it. Though, placing your <generate
type="directory"/> in a <pipeline type="non-caching"> might circumvent the
bug. Haven't tested.

Alternatively, you could add a literal <xi:include> in your xsl and
transform it with <transform type="xinclude"> _before_ using it in a
<transform type="xsl">. Much more code though. It will more or less look
like this:

<map:match pattern="get-images.xml">
   <map:generate type="directory">
     <map:parameter name="include" value="*.jpg"/>
   </map:generate>
   <map:serialize type="xml"/>
</map:match>

<map:match pattern="**.xsl">
   <map:generate src="{1}.xsl"/>
   <map:transform type="xinlcude"/>
   <map:serialize type="xml" />
</map:match>

<map:match pattern="process-images/**">
   <map:generate src="cocoon:/{1}" />
   <map:transform src="cocoon:/process-images.xsl"/>
   <map:serialize type="xml" />
</map:match>

<!-- and in your xsl -->

<xsl:stylesheet ...>

   <xi:include src="cocoon:/get-images.xml" parse="xml" /> <!-- syntax
correct? -->

   <xsl:variable name="images" select="document('')/dir:directory/dir:file"
/> <!-- make sure to define the dir namespace -->

   <xsl:template match="foo/@image-url">
     <xsl:variable name="image" select="[EMAIL PROTECTED] =
current()/@image-url]"/>
     <xsl:variable name="image_temp" select="[EMAIL PROTECTED] =
concat(substring-before(current()/@image-url, '.jpg'), '_temp.jpg')]"/>
     <xsl:choose>
       <!-- sorry, bit lazy -->
       when $image insert image url
       when $image_temp insert image_temp url
       otherwise ???
     </xsl:choose>
   </xsl:template>

Once again, haven't tested, but should work i think... :)

Cheers...



---------------------------------------------------------------------
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]




-- [EMAIL PROTECTED] IT-consultant at Daidalos BV, Zoetermeer (NL)

http://www.daidalos.nl/
tel:+31-(0)79-3316961
fax:+31-(0)79-3316464

GPG: 1024D/12DEBB50

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to