camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Headers in XSLT
Date Thu, 18 Sep 2008 18:54:42 GMT
BTW I raised a JIRA to document the XPath/XSLT/XQuery use of
parameters/methods/namespaces for accessing headers and properties etc
https://issues.apache.org/activemq/browse/CAMEL-918

2008/9/18 raulvk.soa <raulvk.soa@gmail.com>:
>
> Nevermind. By exploring the source code I found out that the XsltComponent
> actually sets all headers and properties as input parameters on the
> underlying Xslt Transformer.
>
> Just to share my findings: all you have to do is find out the name of the
> Exchange property or Message header you want to use within your XSLT and
> declare it as an <xsl:param> at the top of your XSL file. This will allow
> you to use it as any other standard variable inside the XSLT file.
>
> Just a caveat, while exploring the source code, I found out that if there
> are two properties/headers with the same name (even if one is a header and
> the other one is a property), the one that is processed second will NOT be
> inserted as a parameter on the Transformer and will be ignored.
>
> Perhaps this logic should be modified to avoid possible misinterpretations
> and unintended behaviour. A possible solution is to prefix properties with
> the string "property." and headers with "header.", before adding them to the
> parameters Hashtable.
>
> By doing this, properties and headers would be living in separate symbol
> spaces and they would not clash.
>
> What are your thoughts on this?
>
>
> raulvk.soa wrote:
>>
>> Sorry, apparently its not a header, but a Property, according to the logs.
>>
>>
>>
>> raulvk.soa wrote:
>>>
>>> Hi,
>>>
>>> How can I access the headers of a message from XSLT?
>>> Basically, I am validating a message against an XML Schema, and when the
>>> validation fails, I want to generate a specific XML response message that
>>> should contain:
>>>    - the in message
>>>    - the description of the error
>>>    - timestamp
>>>
>>> The in message and the timestamp are not a problem, whereas I see that
>>> the error description is stored in the message header
>>> "org.apache.camel.processor.DeadLetterChannel.FAILURE_HANDLED". Thus, I
>>> need to extract the content of that header from within the XSLT.
>>>
>>> Any clues?
>>>
>>> Thanks.
>>>
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Headers-in-XSLT-tp19552778s22882p19556970.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Mime
View raw message