You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by anupamsen <an...@yahoo.com> on 2012/08/24 15:24:55 UTC

Defaulting using XSLT.

Hi,

I have a requirement such that I need to merge 2 XMLs, The sources are as
follows -
1) XML coming in as an input payload as part of WS 
2)The default values stored in DB in form of XML. 

The problem at hand is if the values of the defaulted tags are not provided
in the incoming payload, then have the values supplied in the respective
node of the defaulting document. 

Defaulting document -

<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog>
  <book>
    *<publisher>Unknown</publisher>*
  </book>
</catalog>

Incoming document -

<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog>
  <book>
    <title>Title1</title>
    <description>Description1</description>
  </book>
</catalog>

Resultant merged Document to be delegated to my underlying service -

<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog>
  <book>
    <title>Title1</title>
    <description>Description1</description>
    <publisher>ABC</publisher>
    *<publisher>Unknown</publisher>*
  </book>
</catalog>

This is something that can be achieved with XSLT but the thing is this is
based on the transformer. Is this possible by using default XSLT processor
component that comes with Camel. "xslt:" ?



--
View this message in context: http://camel.465427.n5.nabble.com/Defaulting-using-XSLT-tp5718015.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Defaulting using XSLT.

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah the xslt component does xslt transformations.
http://camel.apache.org/xslt

On Fri, Aug 24, 2012 at 3:24 PM, anupamsen <an...@yahoo.com> wrote:
> Hi,
>
> I have a requirement such that I need to merge 2 XMLs, The sources are as
> follows -
> 1) XML coming in as an input payload as part of WS
> 2)The default values stored in DB in form of XML.
>
> The problem at hand is if the values of the defaulted tags are not provided
> in the incoming payload, then have the values supplied in the respective
> node of the defaulting document.
>
> Defaulting document -
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <catalog>
>   <book>
>     *<publisher>Unknown</publisher>*
>   </book>
> </catalog>
>
> Incoming document -
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <catalog>
>   <book>
>     <title>Title1</title>
>     <description>Description1</description>
>   </book>
> </catalog>
>
> Resultant merged Document to be delegated to my underlying service -
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <catalog>
>   <book>
>     <title>Title1</title>
>     <description>Description1</description>
>     <publisher>ABC</publisher>
>     *<publisher>Unknown</publisher>*
>   </book>
> </catalog>
>
> This is something that can be achieved with XSLT but the thing is this is
> based on the transformer. Is this possible by using default XSLT processor
> component that comes with Camel. "xslt:" ?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Defaulting-using-XSLT-tp5718015.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen