| Author | 
		  Message
		 | 
		
		  | bhupinder | 
		  
		    
			  
				 Posted: Thu Jun 18, 2015 10:19 pm    Post subject: How to transform Non XML message (like CSV) to XML using XSL | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 25 Mar 2015 Posts: 19
  
  | 
		  
		    
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Fri Jun 19, 2015 4:27 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				Why do you believe that XSLT can work on input documents that are not XML?
 
 
It can output them, but that doesn't mean it can read them.
 
 
That sample XSLT is a real hack, using repeated string split functions to separate out chunks of data.
 
 
If you're using broker there's no strong reason to use XSLT.  You should build a DFDL model of your CSV file, and then use normal Broker transformations (mapping node if you only know XSLT) to achieve your result - unless the XML structure directly matches the CSV format, in which case you can just change the output parser.
 
 
Also, you need to make sure you provide a much better description of your problems than "it's not working".
 
 
Because, clearly, if it's "not working", then you forgot to sacrifice the goat. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bhupinder | 
		  
		    
			  
				 Posted: Fri Jun 19, 2015 4:47 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 25 Mar 2015 Posts: 19
  
  | 
		  
		    
			  
				Thanks for your reply.
 
And apologies for not providing much inputs. 
 
Actually I have tried with DFDL also (Works For static Transformation Logic). But here the requirement is little different, the expectation is something like this:
 
 
We need to transform Non XML message to XML and the transformation logic should be Dynamic. 
 
Like in case of XML2XML conversion i was able to do it by placing XSLT in WSRR and embedding it in my XML for the transformation. So whenever there is any change in Transformation Logic, we don't need to touch the code again. 
 
 
Similar requirement here for Non XML message. Now at some links (like I have provided in my post) It is mentioned that we can transform Non XML2XML using XSLT. But at some places it is mentioned that we can transform from XML to HTML format only (which is based on XML only). So i was not sure....
 
 
I have one more option in Mind, As we are getting XSLT(in case of XML2XML conversion) from WSRR and then using it 
 
Similarly if we can upload .xsd OR mxsd in WSRR and can use it in ESQL for transformation...where we give statements like Message Set, Message Format etc. for transformation | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Fri Jun 19, 2015 5:13 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				Yes, ok.  The transformation should be Dynamic.
 
 
Why, exactly?  How often does this really change? 
 
 
Did some architect or lead programmer decide this was a cool idea? 
 
 
Who's going to author the transformations?  
 
 
What's the value of keeping it in a version controlled part of WSRR verses keeping it in a version controlled part of IIB?  
 
 
You could certainly build a generic DFDL model for CSV files (or, really, just use the presupplied one) and then write basic transformation logic like that... 
 
 
Have you looked using the features of the mapping node to call a different map routine at runtime? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bhupinder | 
		  
		    
			  
				 Posted: Mon Jun 22, 2015 9:22 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 25 Mar 2015 Posts: 19
  
  | 
		  
		    
			  
				Thank you so much for your reply...
 
 
Now as per your inputs.. I have got the details that we can Assign a Map dynamically in the LocalEnvironment.
 
 
Now I am trying to implement the approach in such a way. Uploading the .map File in WSRR. Even I am able to retrieve it and save it in my Local Directory. Is there any option that we can assign that .map File to the mapping Node.
 
 
Whenever I am assigning it, I am getting the below Exception by the Mapping Node:
 
 
ExceptionList
 
	RecoverableException
 
			File:CHARACTER:F:\build\slot1\S900_P\src\DataFlowEngine\MessageServices\ImbDataFlowNode.cpp
 
			Line:INTEGER:1155
 
			Function:CHARACTER:ImbDataFlowNode::createExceptionList
 
			Type:CHARACTER:ComIbmMQInputNode
 
			Name:CHARACTER:DynamicMapping#FCMComposite_1_1
 
			Label:CHARACTER:DynamicMapping.MQ Input
 
			Catalog:CHARACTER:BIPmsgs
 
			Severity:INTEGER:3
 
			Number:INTEGER:2230
 
			Text:CHARACTER:Node throwing exception
 
			Insert
 
					Type:INTEGER:14
 
					Text:CHARACTER:DynamicMapping.MQ Input
 
			RecoverableException
 
					File:CHARACTER:F:\build\slot1\S900_P\src\DataFlowEngine\PluginInterface\ImbJniNode.cpp
 
					Line:INTEGER:1304
 
					Function:CHARACTER:ImbJniNode::evaluate
 
					Type:CHARACTER:SRRetrieveEntityNode
 
					Name:CHARACTER:DynamicMapping#FCMComposite_1_6
 
					Label:CHARACTER:DynamicMapping.Registry Lookup
 
					Catalog:CHARACTER:BIPmsgs
 
					Severity:INTEGER:3
 
					Number:INTEGER:2230
 
					Text:CHARACTER:Caught exception and rethrowing
 
					Insert
 
							Type:INTEGER:14
 
							Text:CHARACTER:DynamicMapping.Registry Lookup
 
					RecoverableException
 
							File:CHARACTER:F:\build\slot1\S900_P\src\DataFlowEngine\PluginInterface\ImbJniNode.cpp
 
							Line:INTEGER:1304
 
							Function:CHARACTER:ImbJniNode::evaluate
 
							Type:CHARACTER:ComIbmMSLMappingNode
 
							Name:CHARACTER:DynamicMapping#FCMComposite_1_3
 
							Label:CHARACTER:DynamicMapping.Mapping
 
							Catalog:CHARACTER:BIPmsgs
 
							Severity:INTEGER:3
 
							Number:INTEGER:2230
 
							Text:CHARACTER:Caught exception and rethrowing
 
							Insert
 
									Type:INTEGER:14
 
									Text:CHARACTER:DynamicMapping.Mapping
 
							RecoverableException
 
									File:CHARACTER:MbMapError.java
 
									Line:INTEGER:64
 
									Function:CHARACTER:getMapExecutable
 
									Type:CHARACTER:
 
									Name:CHARACTER:
 
									Label:CHARACTER:
 
									Catalog:CHARACTER:BIPmsgs
 
									Severity:INTEGER:3
 
									Number:INTEGER:3943
 
									Text:CHARACTER:Unable to locate file for specified map
 
									Insert
 
											Type:INTEGER:5
 
											Text:CHARACTER:C:\Users\DynamicMapping_Mapping_back.map
 
									Insert
 
											Type:INTEGER:5
 
											Text:CHARACTER:MapResourceManager
 
									Insert
 
											Type:INTEGER:5
 
											Text:CHARACTER:getMapExecutable | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bhupinder | 
		  
		    
			  
				 Posted: Mon Jun 22, 2015 9:24 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 25 Mar 2015 Posts: 19
  
  | 
		  
		    
			  
				Whereas my .map file looks like this:
 
 
<?xml version="1.0" encoding="UTF-8"?><mappingRoot xmlns="http://www.ibm.com/2008/ccl/Mapping" domainID="com.ibm.msl.mapping.xml" domainIDExtension="mb" mainMap="true" targetNamespace="default" version="8.0.4.0" xmlns:map="default">
 
    <input path="/MobilyCSV_MSET.xsd"/>
 
    <output path="/Employee.xsd"/>
 
    <generation engine="xquery"/>
 
    <mappingDeclaration name="DynamicMapping_Mapping">
 
        <input path="mb:msg(MobilyCSV_MSET,assembly,DFDL,Properties)"/>
 
        <output path="mb:msg(Employee,assembly,XMLNSC,Properties)"/>
 
        <move>
 
            <input path="Properties"/>
 
            <output path="Properties"/>
 
        </move>
 
        <foreach>
 
            <input path="MobilyCSV_MSET/record"/>
 
            <output path="Employee"/>
 
            <move automap="true">
 
                <input path="AcctID"/>
 
                <output path="AccountID"/>
 
            </move>
 
            <move>
 
                <input path="EmpID"/>
 
                <output path="EmployeeID"/>
 
            </move>
 
            <move>
 
                <input path="EmpName"/>
 
                <output path="EmpName"/>
 
            </move>
 
            <move>
 
                <input path="BatchNo"/>
 
                <output path="BatchNumber"/>
 
            </move>
 
            <move>
 
                <input path="Dept"/>
 
                <output path="Department"/>
 
            </move>
 
        </foreach>
 
    </mappingDeclaration>
 
</mappingRoot> | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Mon Jun 22, 2015 9:27 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				| It sounds like the mapping node can't find the file for the map. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bhupinder | 
		  
		    
			  
				 Posted: Mon Jun 22, 2015 9:57 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 25 Mar 2015 Posts: 19
  
  | 
		  
		    
			  
				But the file is there.
 
Do you know how internally it processes this file? Can you suggest some turnaround here. MANY THANKS..... | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Mon Jun 22, 2015 9:58 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				| Does the documentation say it should be the name of a file? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |