| Author | 
		  Message
		 | 
		
		  | bhupinder | 
		  
		    
			  
				 Posted: Wed Mar 25, 2015 7:14 am    Post subject: Dynamic XSLT content from WSRR | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 25 Mar 2015 Posts: 19
  
  | 
		  
		    
			  
				Hello All,
 
 
I am trying to get the XSLT information from WSRR using Registry Lookup Node.
 
I am able to read the content of .xsl in the path OutputLocalEnvironment.ServiceRegistry.Entity.content
 
 
But now my requirement is to Transform the Input Message with the content which I have extracted from WSRR.
 
 
Can you Please suggest me what are the Options available to do this?
 
 
I am trying to do this using JCN by giving the Stylesheet Processing instructions but my question is how IIB will understand the .xsl functions like value of() in the content variable (in which we have the extracted xsl from WSRR) | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | nelson | 
		  
		    
			  
				 Posted: Wed Mar 25, 2015 7:25 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Partisan
 
 Joined: 02 Oct 2012 Posts: 313
  
  | 
		  
		    
			  
				| Please take a look at this sample. It includes the code, if you want to test the scenario. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bhupinder | 
		  
		    
			  
				 Posted: Wed Mar 25, 2015 7:37 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 25 Mar 2015 Posts: 19
  
  | 
		  
		    
			  
				Thanks nelson.
 
 
Yes, I have already referred that link    
 
 
Adding to my previous post,
 
 
My XSLT is like this:
 
   
	| Code: | 
   
  
	<?xml version="1.0" encoding="UTF-8"?>
 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
 
            xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 
            id="requestTransform"
 
            version="1.0">
 
    <!-- =============================================================== -->
 
    <!-- Template to handle the SOAP Envelope.                           -->
 
    <!-- =============================================================== -->
 
    <xsl:template match="/soapenv:Envelope">
 
        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
           <soapenv:Body>
 
              <Request>
 
                 <verbX><xsl:value-of select="//Verb/text()"/></verbX>
 
                 <DataX>
 
                    <CustomerX><xsl:value-of select="//Customer/text()"/></CustomerX>
 
                    <AgeX><xsl:value-of select="//Age/text()"/></AgeX>
 
                 </DataX>
 
              </Request>
 
           </soapenv:Body>
 
        </soapenv:Envelope>    
 
    </xsl:template>
 
</xsl:stylesheet> | 
   
 
 
 
Whereas my Input Message is :
 
   
	| Code: | 
   
  
	<?xml version="1.0" encoding="UTF-8"?>
 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
  <soapenv:Body>
 
    <Request>
 
     <Version>1.0</Version>
 
     <Stylesheet>DemoCustomer.xsl</Stylesheet>
 
      <Verb>UpdateCustomer</Verb>
 
      <Data>
 
        <Customer>ABC</Customer>
 
      <Age>28</Age>
 
      </Data>
 
    </Request>
 
  </soapenv:Body>
 
</soapenv:Envelope> | 
   
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | nelson | 
		  
		    
			  
				 Posted: Wed Mar 25, 2015 7:53 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Partisan
 
 Joined: 02 Oct 2012 Posts: 313
  
  | 
		  
		    
			  
				| What problems are you facing? The JCN passes the XSLT stylesheet (retrieved from WSRR) to the XSLTransform node and then the transformation occurs. You shouldn't be worried of what the XSLTransform node is doing internally. If the XSLT stylesheet and the input message are correct, the transformation should work fine. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bhupinder | 
		  
		    
			  
				 Posted: Sun May 24, 2015 3:32 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 25 Mar 2015 Posts: 19
  
  | 
		  
		    
			  
				I am able to embed the XSLT into XML Message.
 
 
Now the only problem is while reading it in XSL Transform Node. I am getting the below exception.
 
 
   
	| Code: | 
   
  
	**************************
 
( ['MQROOT' : 0x2bfe6130]
 
  (0x01000000:Name):RecoverableException = (
 
    (0x03000000:NameValue):File                 = 'F:\build\slot1\S900_P\src\DataFlowEngine\MessageServices\ImbDataFlowNode.cpp' (CHARACTER)
 
    (0x03000000:NameValue):Line                 = 1155 (INTEGER)
 
    (0x03000000:NameValue):Function             = 'ImbDataFlowNode::createExceptionList' (CHARACTER)
 
    (0x03000000:NameValue):Type                 = 'SRRetrieveEntityNode' (CHARACTER)
 
    (0x03000000:NameValue):Name                 = 'WSRRDynamicXSLTLookup#FCMComposite_1_3' (CHARACTER)
 
    (0x03000000:NameValue):Label                = 'WSRRDynamicXSLTLookup.XSLTLookup' (CHARACTER)
 
    (0x03000000:NameValue):Catalog              = 'BIPmsgs' (CHARACTER)
 
    (0x03000000:NameValue):Severity             = 3 (INTEGER)
 
    (0x03000000:NameValue):Number               = 2230 (INTEGER)
 
    (0x03000000:NameValue):Text                 = 'Node throwing exception' (CHARACTER)
 
    (0x01000000:Name     ):Insert               = (
 
      (0x03000000:NameValue):Type = 14 (INTEGER)
 
      (0x03000000:NameValue):Text = 'WSRRDynamicXSLTLookup.XSLTLookup' (CHARACTER)
 
    )
 
    (0x01000000:Name     ):RecoverableException = (
 
      (0x03000000:NameValue):File                 = 'F:\build\slot1\S900_P\src\DataFlowEngine\PluginInterface\ImbJniNode.cpp' (CHARACTER)
 
      (0x03000000:NameValue):Line                 = 1304 (INTEGER)
 
      (0x03000000:NameValue):Function             = 'ImbJniNode::evaluate' (CHARACTER)
 
      (0x03000000:NameValue):Type                 = 'ComIbmXslMqsiNode' (CHARACTER)
 
      (0x03000000:NameValue):Name                 = 'WSRRDynamicXSLTLookup#FCMComposite_1_5' (CHARACTER)
 
      (0x03000000:NameValue):Label                = 'WSRRDynamicXSLTLookup.XSL Transform' (CHARACTER)
 
      (0x03000000:NameValue):Catalog              = 'BIPmsgs' (CHARACTER)
 
      (0x03000000:NameValue):Severity             = 3 (INTEGER)
 
      (0x03000000:NameValue):Number               = 2230 (INTEGER)
 
      (0x03000000:NameValue):Text                 = 'Caught exception and rethrowing' (CHARACTER)
 
      (0x01000000:Name     ):Insert               = (
 
        (0x03000000:NameValue):Type = 14 (INTEGER)
 
        (0x03000000:NameValue):Text = 'WSRRDynamicXSLTLookup.XSL Transform' (CHARACTER)
 
      )
 
      (0x01000000:Name     ):RecoverableException = (
 
        (0x03000000:NameValue):File     = 'XMLTransformNode.java' (CHARACTER)
 
        (0x03000000:NameValue):Line     = 977 (INTEGER)
 
        (0x03000000:NameValue):Function = 'transformData' (CHARACTER)
 
        (0x03000000:NameValue):Type     = '' (CHARACTER)
 
        (0x03000000:NameValue):Name     = '' (CHARACTER)
 
        (0x03000000:NameValue):Label    = '' (CHARACTER)
 
        (0x03000000:NameValue):Catalog  = 'BIPmsgs' (CHARACTER)
 
        (0x03000000:NameValue):Severity = 3 (INTEGER)
 
        (0x03000000:NameValue):Number   = 4443 (INTEGER)
 
        (0x03000000:NameValue):Text     = 'Stylesheet not found with given priorities' (CHARACTER)
 
        (0x01000000:Name     ):Insert   = (
 
          (0x03000000:NameValue):Type = 5 (INTEGER)
 
          (0x03000000:NameValue):Text = 'XSL Transform' (CHARACTER)
 
        )
 
        (0x01000000:Name     ):Insert   = (
 
          (0x03000000:NameValue):Type = 5 (INTEGER)
 
          (0x03000000:NameValue):Text = '3' (CHARACTER)
 
        )
 
        (0x01000000:Name     ):Insert   = (
 
          (0x03000000:NameValue):Type = 5 (INTEGER)
 
          (0x03000000:NameValue):Text = '2' (CHARACTER)
 
        )
 
        (0x01000000:Name     ):Insert   = (
 
          (0x03000000:NameValue):Type = 5 (INTEGER)
 
          (0x03000000:NameValue):Text = '1' (CHARACTER)
 
        )
 
      )
 
    )
 
  )
 
);
 
********************************
 
My Sample Input XML is:
 
<?xml version="1.0" encoding="UTF-8"?>
 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"..  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
 <soapenv:Body>
 
  <Request>
 
   <Version>1.0</Version>
 
   <ServiceName>DemoCustomer</ServiceName>
 
   <Verb>UpdateCustomer</Verb>
 
   <Data>
 
    <Customer>ABC</Customer>
 
    <Age>28</Age>
 
   </Data>
 
  </Request>
 
 </soapenv:Body>
 
</soapenv:Envelope> | 
   
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bhupinder | 
		  
		    
			  
				 Posted: Sun May 24, 2015 3:52 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 25 Mar 2015 Posts: 19
  
  | 
		  
		    
			  
				Just to update all of you, that I have referred the below links while resolving (embedding the Stylesheet in the message) problem.
 
http://mqseries.net/phpBB2/viewtopic.php?t=25098&highlight=xsl&sid=8fc73ba2b6345a85ea3941c30d002bee
 
http://mqseries.net/phpBB2/viewtopic.php?p=137279&sid=8a8a71dd3ea2bda406ced52000b88bd5
 
 
Now the pending part is I am unable to use embedded XSLT in my XSL Transform Node.
 
 
Below is the structure of XML before the Transform Node...
 
************************************************
 
XML Structure in DEBUG view
 
>>>>>>>>>>>>>>>>>
 
XMLNSC
 
	XmlDeclaration
 
			Version:CHARACTER:1.0
 
			Encoding:CHARACTER:UTF-8
 
	Envelope
 
			soapenv:CHARACTER:http://schemas.xmlsoap.org/soap/envelope/
 
			xsi:CHARACTER:http://www.w3.org/2001/XMLSchema-instance
 
			Body
 
					Request
 
							Version:CHARACTER:1.0
 
							ServiceName:CHARACTER:DemoCustomer
 
							Verb:CHARACTER:UpdateCustomer
 
							Data
 
									Customer:CHARACTER:ABC
 
									Age:CHARACTER:28
 
	xml-stylesheet:CHARACTER:type="text/xsl" href="#<?xml version="1.0" encoding="UTF-8"?>
 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
 
				xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 
				xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 
				id="requestTransform"
 
				version="1.0">
 
 
 
    <!-- =============================================================== -->
 
    <!-- Template to handle the SOAP Envelope.                           -->
 
    <!-- =============================================================== -->
 
    <xsl:template match="/soapenv:Envelope">
 
        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
        	<soapenv:Body>
 
        		<Request>
 
        			<verbX><xsl:value-of select="//Verb/text()"/></verbX>
 
        			<DataX>
 
        				<CustomerX><xsl:value-of select="//Customer/text()"/></CustomerX>
 
        				<AgeX><xsl:value-of select="//Age/text()"/></AgeX>
 
        			</DataX>
 
        		</Request>
 
        	</soapenv:Body>
 
        </soapenv:Envelope>    
 
    </xsl:template>
 
</xsl:stylesheet>
 
"
 
 
Can Anyone Please help me to resolve this..Thanks in Advance. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bhupinder | 
		  
		    
			  
				 Posted: Sun May 24, 2015 4:01 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 25 Mar 2015 Posts: 19
  
  | 
		  
		    
			  
				My Sample Code Looks like this:
 
DECLARE wsrrContent CHARACTER;
 
		 DECLARE contentRef REFERENCE TO InputLocalEnvironment.ServiceRegistry.Entity.content;
 
		 SET Environment.Variables.xslContent = contentRef;
 
		 SET wsrrContent = CAST(Environment.Variables.xslContent AS CHARACTER);
 
		 
 
		 DECLARE styleSheetID REFERENCE TO wsrrContent.{'xsl:stylesheet'}.(XML.Attribute)id;
 
		 IF LASTMOVE(styleSheetID) = TRUE THEN	
 
		 SET OutputRoot.XMLNSC.(XMLNSC.ProcessingInstruction)"xml-stylesheet" = 'type="text/xsl" href="#' || styleSheetID || '"'; | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bhupinder | 
		  
		    
			  
				 Posted: Tue May 26, 2015 1:54 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 25 Mar 2015 Posts: 19
  
  | 
		  
		    
			  
				I have progressed one more step:
 
 
Now I am getting the below exception, can anyone please help me to get it sorted...
 
 
Exception:
 
*****************
 
ExceptionList
 
	RecoverableException
 
			File:CHARACTER:F:\build\slot1\S900_P\src\DataFlowEngine\MessageServices\ImbDataFlowNode.cpp
 
			Line:INTEGER:1155
 
			Function:CHARACTER:ImbDataFlowNode::createExceptionList
 
			Type:CHARACTER:ComIbmXslMqsiNode
 
			Name:CHARACTER:WSRRDynamicXSLTLookup#FCMComposite_1_5
 
			Label:CHARACTER:WSRRDynamicXSLTLookup.XSL Transform
 
			Catalog:CHARACTER:BIPmsgs
 
			Severity:INTEGER:3
 
			Number:INTEGER:2230
 
			Text:CHARACTER:Node throwing exception
 
			Insert
 
					Type:INTEGER:14
 
					Text:CHARACTER:WSRRDynamicXSLTLookup.XSL Transform
 
			RecoverableException
 
					File:CHARACTER:XMLTransformNode.java
 
					Line:INTEGER:995
 
					Function:CHARACTER:transformData
 
					Type:CHARACTER:
 
					Name:CHARACTER:
 
					Label:CHARACTER:
 
					Catalog:CHARACTER:BIPmsgs
 
					Severity:INTEGER:3
 
					Number:INTEGER:4447
 
					Text:CHARACTER:Error during transformation
 
					Insert
 
							Type:INTEGER:5
 
							Text:CHARACTER:XSL Transform
 
					Insert
 
							Type:INTEGER:5
 
							Text:CHARACTER:Transformation failure when processing Stylesheet #requestTransformCould not find inline stylesheet in XML with ID=#requestTransform
 
 
 
Below is my XMLNSC Tree in Debugger before XSL Transform Node (where it fails)
 
***********************************************************
 
 
XMLNSC
 
	xml-stylesheet:CHARACTER:type="text/xsl" href="#requestTransform"
 
	Query
 
			OrderID:CHARACTER:1234567
 
			TxnID:CHARACTER:TX234345
 
			MobileNo:CHARACTER:5423776633
 
			AcctID:CHARACTER:1234567865
 
			CustomerNm:CHARACTER:BHUPINDER
 
			Addr:CHARACTER:AUNDH
 
			Cty:CHARACTER:PUNE
 
			stylesheet
 
					xsl:CHARACTER:http://www.w3.org/1999/XSL/Transform
 
					id:CHARACTER:requestTransform
 
					version:CHARACTER:1.0
 
					template
 
							match:CHARACTER:stylesheet
 
					template
 
							match:CHARACTER:/
 
							Query
 
									ORDER_ID
 
											value-of
 
													select:CHARACTER://OrderID/text()
 
									TRANSACTION_ID
 
											value-of
 
													select:CHARACTER://TxnID/text()
 
									MOBILE_NUMBER
 
											value-of
 
													select:CHARACTER://MobileNo/text()
 
									ACCOUNT_ID
 
											value-of
 
													select:CHARACTER://AcctID/text()
 
									CUSTOMER_NAME
 
											value-of
 
													select:CHARACTER://CustomerNm/text()
 
									ADDRESS
 
											value-of
 
													select:CHARACTER://Addr/text()
 
									CITY
 
											value-of
 
													select:CHARACTER://Cty/text()
 
 
 
Below is my Sample Code:
 
DECLARE inCCSID INT InputProperties.CodedCharSetId;
 
		 DECLARE inEncoding INT InputProperties.Encoding;
 
		 DECLARE contentRef CHARACTER;
 
--		 SET OutputLocalEnvironment = InputLocalEnvironment;
 
		 SET contentRef = InputLocalEnvironment.ServiceRegistry.Entity.content;
 
		 CREATE LASTCHILD OF OutputLocalEnvironment DOMAIN ('XMLNSC') PARSE(contentRef, inEncoding, inCCSID);
 
		 DECLARE styleSheetID CHARACTER;
 
		 SET styleSheetID = OutputLocalEnvironment.XMLNSC.*:stylesheet.(XMLNSC.Attribute)id;
 
--		 IF LASTMOVE(styleSheetID) = TRUE THEN
 
		 	SET OutputRoot.XMLNSC.(XMLNSC.ProcessingInstruction)"xml-stylesheet" = 'type="text/xsl" href="#' || styleSheetID || '"';
 
			 SET OutputRoot.XMLNSC.Query = InputRoot.XMLNSC.Query;
 
			 SET OutputRoot.XMLNSC.Query.stylesheet = OutputLocalEnvironment.XMLNSC.*:stylesheet;
 
 
I have parsed the message to XMLNSC, before embedding XSLT.
 
But without Parsing also it was giving the same Exception (Transformation failure.... not find inline stylesheet in XML....). 
 
 
Below is my XSLT with minor changes now
 
***********************************
 
 
<?xml version="1.0" encoding="UTF-8"?>
 
<xsl:stylesheet id="requestTransform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 
	<xsl:template match="stylesheet"/>
 
	<xsl:template match="/">
 
		<Query>    
 
                <ORDER_ID><xsl:value-of select="//OrderID/text()"/></ORDER_ID>
 
                <TRANSACTION_ID><xsl:value-of select="//TxnID/text()"/></TRANSACTION_ID>
 
                <MOBILE_NUMBER><xsl:value-of select="//MobileNo/text()"/></MOBILE_NUMBER>
 
                <ACCOUNT_ID><xsl:value-of select="//AcctID/text()"/></ACCOUNT_ID>
 
                <CUSTOMER_NAME><xsl:value-of select="//CustomerNm/text()"/></CUSTOMER_NAME>
 
				<ADDRESS><xsl:value-of select="//Addr/text()"/></ADDRESS>
 
				<CITY><xsl:value-of select="//Cty/text()"/></CITY>	
 
        </Query>
 
     </xsl:template>
 
</xsl:stylesheet>
 
 
 
 
Looking for your guidance    
 
 
MANY THANKS | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bhupinder | 
		  
		    
			  
				 Posted: Wed May 27, 2015 1:59 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 25 Mar 2015 Posts: 19
  
  | 
		  
		    
			  
				BINGO...the issue is resolved now..
 
 
I am using this code for XSL embedding and using it for Transformation:
 
 
   
	| Code: | 
   
  
	CREATE COMPUTE MODULE WSRRDynamicXSLTLookup_parseXSLT
 
   CREATE FUNCTION Main() RETURNS BOOLEAN
 
   BEGIN
 
      
 
      CALL CopyMessageHeaders();
 
      
 
--       CALL CopyEntireMessage();
 
       
 
       DECLARE inCCSID INT InputProperties.CodedCharSetId;
 
       DECLARE inEncoding INT InputProperties.Encoding;
 
       DECLARE contentRef CHARACTER;
 
       SET OutputLocalEnvironment = InputLocalEnvironment;
 
       SET contentRef = InputLocalEnvironment.ServiceRegistry.Entity.content;
 
       CREATE LASTCHILD OF OutputLocalEnvironment DOMAIN ('XMLNSC') PARSE(contentRef, inEncoding, inCCSID);
 
       DECLARE styleSheetID REFERENCE TO OutputLocalEnvironment.XMLNSC.*:stylesheet.(XMLNSC.Attribute)id;
 
       IF LASTMOVE(styleSheetID) = TRUE THEN
 
           SET OutputRoot.XMLNSC.(XMLNSC.ProcessingInstruction)"xml-stylesheet" = 'type="text/xml" href="#' || styleSheetID || '"';
 
           SET OutputRoot.XMLNSC.Query = InputRoot.XMLNSC.Query;
 
           SET OutputRoot.XMLNSC.Query.{'xsl:stylesheet'} = OutputLocalEnvironment.XMLNSC.*:stylesheet;
 
       END IF; 
 
   END; | 
   
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |