RE: Calling function in root sitemap flow

2015-11-13 Thread Daniel Schmidt
Hi Bardo,

there is no inheritance in what you're describing.

However, there's a workaround a lot of people are using:

---



]>
http://apache.org/cocoon/sitemap/1.0;>
  
...
  

  
_global_resources;
  

  
...
  


---

Where sitemap-resources.xmap is just a plain file with what you'd normally 
include into your map:resources block. You can do the same with pipelines if 
you want.

That way you'd have at least a single source for your global sitemap resources. 
You can do the same in the sub sitemaps.

Please note: When you're changing the "sitemap-resources.xmap" file (name it 
how you want), then you have to restart cocoon or you have to save the 
including sitemap again to see your changes. If you have a lot of sub sitemaps, 
the former would be the better option of course.

Hope that helps!

Daniel


From: Bardo Nelgen [mailto:mailing.list.in...@bnnperformances.de]
Sent: Dienstag, 10. November 2015 11:35
To: users@cocoon.apache.org
Subject: Calling function in root sitemap flow

Hi all,

obviously I'm missing something:

Could anyone please point me towards the proper method of calling a function in 
root sitemap flow (incl. passing parameters) from a sub-sitemap's matcher ?

Is this possible at all ?

Thanks for any hint !!

Best,

Bardo


RE: Using Node.js as a Generator

2014-06-04 Thread Daniel Schmidt
Inspiring stuff. Thank you. ☺

From: warrell harries [mailto:warrell.harr...@gmail.com]
Sent: Mittwoch, 4. Juni 2014 10:21
To: users
Subject: Re: Using Node.js as a Generator

Many thanks Francesco!

On 4 June 2014 08:27, Francesco Chicchiriccò 
ilgro...@apache.orgmailto:ilgro...@apache.org wrote:
On 04/06/2014 09:22, warrell harries wrote:
I have posted a simple way of using Node.js with Cocoon

http://warrell.blogspot.co.uk/2014/05/extending-life-of-my-cocoon.html

I hope this may be of some help to anyone similarly minded,

Cool stuff!
Need to immediately tweet about this: 
https://twitter.com/chicchiricco/status/474089743622623232

--
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC
http://people.apache.org/~ilgrosso/


-
To unsubscribe, e-mail: 
users-unsubscr...@cocoon.apache.orgmailto:users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: 
users-h...@cocoon.apache.orgmailto:users-h...@cocoon.apache.org



RE: Trigger Cocoon http response code from within XSL code

2013-12-16 Thread Daniel Schmidt
Hi David,

 Just in case you have not seen it, and to add more connections info to the 
 mail archives:
 http://wiki.apache.org/cocoon/ErrorHandling
 Some of that is old, but there is a good thread linked in the section about 
 Cocoon 2.1 that is relevant:
 Subject: Generators now allowed in map:handle-errors
 http://marc.info/?l=xml-cocoon-devm=104923290631009

Thank you very much for the links provided.

I was able to make it work. Here is the code for throwing individual exceptions 
from within XSLT to the cocoon sitemap:

...
map:selectors
  map:selector name=exception 
src=org.apache.cocoon.selection.XPathExceptionSelector
exception name=FileNotFound 
class=org.apache.cocoon.ResourceNotFoundException/
exception name=Transform 
class=javax.xml.transform.TransformerException unroll=true
  xpath name=ContentNotAvailableInCountry 
test=message='ContentNotAvailableInCountry'/
/exception
exception class=java.lang.Throwable unroll=true/
  /map:selector
/map:selectors
...
map:handle-errors
  map:select type=exception
map:when test=ContentNotAvailableInCountry
  !-- defined xsl:message 
terminate=yesContentNotAvailableInCountry/xsl:message error --
/map:when
map:when test=Transform
  !-- generic xsl:message terminate=yes/ error --
/map:when
map:when test=FileNotFound
  !-- file not found error --
/map:when
map:otherwise
  !-- something else --
/map:otherwise
  /map:select
/map:handle-errors
...

This works for me. The key is to have the unroll=true in it + the order of 
the exceptions/.

I will do further testing.

Cheers,
Daniel

-
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org



RE: Trigger Cocoon http response code from within XSL code

2013-12-13 Thread Daniel Schmidt
Hi David,

That is great. I got it working with the following code:

map:sitemap xmlns:map=http://apache.org/cocoon/sitemap/1.0;
map:components
...
map:selectors
map:selector name=exception 
src=org.apache.cocoon.selection.ExceptionSelector
exception name=FileNotFound 
class=org.apache.cocoon.ResourceNotFoundException/
exception name=ContentNotAvailableInCountry 
class=org.apache.cocoon.ProcessingException/
/map:selector
/map:selectors
/map:components
map:resources
map:resource name=404
map:generate src=404.xml/
map:serialize status-code=404/
/map:resource
map:resource name=404-notavailableinyourcountry
map:generate src=404-notavailableinyourcountry.xml/
map:serialize status-code=404/
/map:resource
...
/map:resources
map:pipelines
map:pipeline
map:handle-errors
map:select type=exception
map:when 
test=ContentNotAvailableInCountry
map:call 
resource=404-notavailableinyourcountry/
/map:when
map:when test=FileNotFound
map:call resource=404/
/map:when
map:otherwise
!-- something else --
/map:otherwise
/map:select
/map:handle-errors
...
/map:pipeline
/map:pipelines
/map:sitemap


So I always get a ContentNotAvailableInCountry exception if I do a 
xsl:message terminate=yes/ in XSLT. Otherwise I'm serving a generic error 
page or a FileNotFound error page.


However, it would be great if I could throw different exceptions from within 
XSLT with the following approach:
xsl:message terminate=yesContentNotAvailableInCountry/xsl:message

I tried using an XPathExceptionSelector instead of the ExceptionSelector (the 
numbers 1/2 in the code below are only there to point out a line; they are not 
part of the code):

map:selector name=exception 
src=org.apache.cocoon.selection.XPathExceptionSelector
exception name=Transform 
class=org.apache.cocoon.ProcessingException
(1) xpath name=ContentNotAvailableInCountry 
test=rawMessage='Failed to process pipeline'/
(2) xpath name=ContentNotAvailableInCountry 
test=message='ContentNotAvailableInCountry'/
/exception
/map:selector

While (1) works fine (it's equal to the ExceptionSelector approach since I 
can't say what's the content of xsl:message/), I can't get (2) working.

How can I test if the content of xsl:message terminate=yes/ is a certain 
string with the help of XPathExceptionSelector?


Thank you!




-Original Message-
From: David Crossley [mailto:cross...@apache.org] 
Sent: Freitag, 13. Dezember 2013 00:49
To: users@cocoon.apache.org
Subject: Re: Trigger Cocoon http response code from within XSL code

Daniel Schmidt wrote:
 Hi Thorsten,
 
 Thanks for pointing out actions. I will have a closer look at them.
 
 Setting the status code is no problem, we already do that. The problem is 
 that we only know within the XSLT code if a page is available in a certain 
 country, because this is defined in XML.

Could use stylesheet-directed termination (xsl:message terminate=yes) Then 
in the relevant sitemap use map:handle-errors to set the status-code on the 
serializer.
http://forrest.apache.org/faq.html#handle-errors

-David

 Thanks.
 
 
 
 From: Thorsten Scherler [mailto:scher...@gmail.com]
 Sent: Donnerstag, 12. Dezember 2013 14:33
 To: users@cocoon.apache.org
 Subject: Re: Trigger Cocoon http response code from within XSL code
 
 On 12/12/2013 02:21 PM, Daniel Schmidt wrote:
 Hi,
 
 In our project we have multiple languages and some pages are not available in 
 a certain country. If that is the case, we just output a message. For Search 
 engines it would be good to respond with a different status code then 200.
 
 The question is: Is it possible to trigger a different http status code from 
 within the XSL-code to the sitemap? Is there a way of doing something like 
 that?
 
 Thank you!
 Daniel
 
 
 Daniel Schmidt | Jr Web Developer | TomTom Business Solutions | 
 daniel.schm...@tomtom.commailto:daniel.schm...@tomtom.com | 
 +49(0)341 24495-920 office | +49(0)341 24495-888 fax | 
 www.tomtom.com/businesshttp://www.tomtom.com/business
 
 
 Depending which version I would suggest an action to do

RE: format-number() bug in XALANJ

2013-12-12 Thread Daniel Schmidt
Thanks for clarifying, Thorsten.

I did a workaround and created my own formatNumber EXSLT function which just 
replaces , and . in a number (10,000.00) with the correct localisation for a 
certain country.

Cheers,
Daniel

From: Thorsten Scherler [mailto:scher...@gmail.com]
Sent: Mittwoch, 11. Dezember 2013 16:37
To: users@cocoon.apache.org
Subject: Re: format-number() bug in XALANJ

On 12/11/2013 03:29 PM, Daniel Schmidt wrote:
Hi all,

Does anybody know what's the status of this ticket?
https://issues.apache.org/jira/browse/XALANJ-2565

After 5 hours of working out a price template with formats for 20 countries I 
ran into that issue.

Thanks,
Daniel


Daniel Schmidt | Jr Web Developer | TomTom Business Solutions | 
daniel.schm...@tomtom.commailto:daniel.schm...@tomtom.com | +49(0)341 
24495-920 office | +49(0)341 24495-888 fax | 
www.tomtom.com/businesshttp://www.tomtom.com/business


Seeing that issue is a xalan one the best bet is to ask over there. Seeing that 
there is a workaround described in the ticket you could patch your own xalan or 
alternatively try saxon in cocoon.

Depending on your cocoon version:
http://wiki.apache.org/cocoon/Saxon
http://mrhaki.blogspot.com.es/2008/09/use-saxon-in-cocoon-22.html
https://issues.apache.org/jira/browse/COCOON3-82
http://markmail.org/message/nzhgv7dm7c6x6xka

HTH


--

Thorsten Scherler scherler.at.gmail.com

codeBusters S.L. - web based systems

consulting, training and solutions



http://www.codebusters.es/


Trigger Cocoon http response code from within XSL code

2013-12-12 Thread Daniel Schmidt
Hi,

In our project we have multiple languages and some pages are not available in a 
certain country. If that is the case, we just output a message. For Search 
engines it would be good to respond with a different status code then 200.

The question is: Is it possible to trigger a different http status code from 
within the XSL-code to the sitemap? Is there a way of doing something like that?

Thank you!
Daniel


Daniel Schmidt | Jr Web Developer | TomTom Business Solutions | 
daniel.schm...@tomtom.commailto:daniel.schm...@tomtom.com | +49(0)341 
24495-920 office | +49(0)341 24495-888 fax | 
www.tomtom.com/businesshttp://www.tomtom.com/business



RE: Trigger Cocoon http response code from within XSL code

2013-12-12 Thread Daniel Schmidt
Hi Thorsten,

Thanks for pointing out actions. I will have a closer look at them.

Setting the status code is no problem, we already do that. The problem is that 
we only know within the XSLT code if a page is available in a certain country, 
because this is defined in XML.

Thanks.



From: Thorsten Scherler [mailto:scher...@gmail.com]
Sent: Donnerstag, 12. Dezember 2013 14:33
To: users@cocoon.apache.org
Subject: Re: Trigger Cocoon http response code from within XSL code

On 12/12/2013 02:21 PM, Daniel Schmidt wrote:
Hi,

In our project we have multiple languages and some pages are not available in a 
certain country. If that is the case, we just output a message. For Search 
engines it would be good to respond with a different status code then 200.

The question is: Is it possible to trigger a different http status code from 
within the XSL-code to the sitemap? Is there a way of doing something like that?

Thank you!
Daniel


Daniel Schmidt | Jr Web Developer | TomTom Business Solutions | 
daniel.schm...@tomtom.commailto:daniel.schm...@tomtom.com | +49(0)341 
24495-920 office | +49(0)341 24495-888 fax | 
www.tomtom.com/businesshttp://www.tomtom.com/business


Depending which version I would suggest an action to do that. There are 
examples how to set the status code, the question which one would you want to 
set? From within xslt I think it is a bit more complicated.

salu2


--

Thorsten Scherler scherler.at.gmail.com

codeBusters S.L. - web based systems

consulting, training and solutions



http://www.codebusters.es/


format-number() bug in XALANJ

2013-12-11 Thread Daniel Schmidt
Hi all,

Does anybody know what's the status of this ticket?
https://issues.apache.org/jira/browse/XALANJ-2565

After 5 hours of working out a price template with formats for 20 countries I 
ran into that issue.

Thanks,
Daniel


Daniel Schmidt | Jr Web Developer | TomTom Business Solutions | 
daniel.schm...@tomtom.commailto:daniel.schm...@tomtom.com | +49(0)341 
24495-920 office | +49(0)341 24495-888 fax | 
www.tomtom.com/businesshttp://www.tomtom.com/business