camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vikas Kumar Arora <vikas_kumar...@yahoo.com>
Subject Camel XSLT, how to pass a Map param to XSL
Date Thu, 13 May 2010 16:57:29 GMT

Hi,
Is there a way to pass Map as a param to XSLT component?
Camel 1.6.2 (As we run on Jdk1.4, no other choice)

Requirement: I've location maps(Properties file) M1, M2 etc from Partners
P1, P2. And before forwarding the request to WS, I have to apply the XSL
Transforamtion to convert P1, P2 etc format to our WS format. But in this
process I've to apply Location Code transformation as well.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
					xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
					xmlns:ws="http://ws.xxxxxx.com"
					xmlns:spml="urn:oasis:names:tc:SPML:2:0"
					xmlns:udc="urn:xxxxx:enterprise:domain:identity:1.0"
					xmlns:xalan="http://xml.apache.org/xalan"
					xmlns:map="java:java.util.Map"
					exclude-result-prefixes="xalan spml ws soapenv"
	                		version="2.0">
			                
		   <xsl:output method="xml" omit-xml-declaration="yes"/>
		   <!--xsl:param name="title"/-->
		   <xsl:param name="map"/>	
			
		   <xsl:template match="@* | node()">
			<xsl:copy>
			   <xsl:apply-templates select="@* | node()" />
			</xsl:copy>
		   </xsl:template>
		   
		   <xsl:template match="udc:UDCIdentity">
		        <!--xsl:value-of select="$title"/-->
		        <xsl:value-of select="map:get($map, 'locationCode')"/>
			<xsl:copy>
			   <xsl:apply-templates select="@* | node()" />
			</xsl:copy>
			
		   </xsl:template>
		
		</xsl:stylesheet>  


Sample Camel Config that I'm experimenting for now:

<camel:route>
			
	<camel:from uri="jetty:http://localhost:8081/AuthN/esb"/>
	
	<camel:setHeader
headerName="myParam1"><camel:constant>1</camel:constant></camel:setHeader>
	<camel:setHeader
headerName="myParam2"><camel:constant>2</camel:constant></camel:setHeader>
	<camel:setHeader
headerName="myParam3"><camel:constant>3</camel:constant></camel:setHeader>
	<camel:setHeader
headerName="myParam4"><camel:constant>4</camel:constant></camel:setHeader>
	<camel:setProperty propertyName="routeId">
	    <camel:header>1</camel:header>
	</camel:setProperty>

	<camel:to uri="xslt:transfomer.xsl"/>
	<camel:to uri="bean:someBean"/>
	<camel:to uri="http://login.dev2.XXXX.edu/AuthN/services/Service"/>
	
	<!-- camel:filter>
	   <camel:mvel>request.headers.foo == 'bar'</camel:mvel>
	   <camel:to uri="http://login.dev2.XXXX.edu/AuthN/services/Service"/>
		</camel:filter-->
	</camel:route>
	
</camel:camelContext>


Some Spring Util config:

<util:properties id="P1" location="classpath:LocationCodes.properties"/>
(I'm not sure how could i inject into Camel SetProperty somewhere).

Any suggestions would help.

Thanks,
Vikas

-- 
View this message in context: http://old.nabble.com/Camel-XSLT%2C-how-to-pass-a-Map-param-to-XSL-tp28550003p28550003.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message