Author |
Message
|
kevin_22 |
Posted: Fri May 19, 2006 6:15 am Post subject: XML Transformation node |
|
|
 Centurion
Joined: 08 Mar 2005 Posts: 100
|
Hi,
I am having an issue regarding the XML Transformation node. I worked with XML Transform node with stylesheetName property specified in the XML Transform Node. I want to try with 'XM: Embeded selection priority' and Message environment selection priority.
i referenced http://mqseries.net/phpBB2/viewtopic.php?t=25098&highlight=xsl&sid=8fc73ba2b6345a85ea3941c30d002bee
I tried with Set OutputLocalEnvironment.ComIbmXslXmltStylesheetname='xsltransform.xsl';
in the compute node. I imported the .xsl into the work space and even deployed into the broker.In Exception list XSL file not found with given priority.
All prority in XML Transformation node having default properties
Please throw more light in to this.
Thanks
kevin |
|
Back to top |
|
 |
XZ |
Posted: Mon May 22, 2006 5:37 am Post subject: XMLT node |
|
|
 Apprentice
Joined: 22 May 2006 Posts: 45 Location: IBM Hursley
|
Hi Kevin,
Could you explain what exactly you want to do?
It seems to me that you intend to specify the name of a style sheet whose content is embedded in the input message on the local envrironment. If this is the case, it is not supported. The OutputLocalEnvironment.ComIbmXslXmltStylesheetname can only be used to point to a style sheet whose content is already stored somewhere (inclding deployed style sheets). If you read http://mqseries.net/phpBB2/viewtopic.php?t=25098&highlight=xsl&sid=8fc73ba2b6345a85ea3941c30d002bee
carefully, the name ("style1") of the embedded style sheet is idetified using
<?xml-stylesheet type="text/xsl" href="#style1"?>
and "style1" is the id of the embedded style sheet defined in:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
id="style1"
xmlns:xalan="http://xml.apache.org/xslt"> |
|
Back to top |
|
 |
kevin_22 |
Posted: Mon May 22, 2006 8:49 pm Post subject: |
|
|
 Centurion
Joined: 08 Mar 2005 Posts: 100
|
Hi XZ,
OutputLocalEnvironment.ComIbmXslXmltStylesheetname this option worked.
thanks.
I have gone thru http://mqseries.net/phpBB2/viewtopic.php?t=25098&highlight=xsl&sid=8fc73ba2b6345a85ea3941c30d002bee
and I need to do same like that. If I embedded the xsl sheet into input xml manually then I am getting right response.
But according to requirements , i need to do it automatically.
I mean ,
1. I have a database of having XSL sheets in DB2.
So I need to get correspongin XSL for input xml from DB2.
EVAL('SELECT T.c1 FROM Database.kevin.emp WHERE T.c = 'xyz') is giving error.
[Microsoft][ODBC Driver Manager] Driver does not support this function.
Now I got stopped here.
thanks XZ once again.
-Kevin |
|
Back to top |
|
 |
XZ |
Posted: Tue May 23, 2006 12:22 am Post subject: embeding style sheets |
|
|
 Apprentice
Joined: 22 May 2006 Posts: 45 Location: IBM Hursley
|
Kevin,
1. You probably need to declare alias "T", ie.,
SET stylesheet = EVAL('SELECT T.c1 FROM Database.kevin.emp AS T WHERE T.c = ' || 'xyz');
2. In order to embedded the style sheet into your input message, you need to something like:
SET OutputRoot = InputRoot;
DECLARE styleSheetID REFERENCE TO styleSheet.{'xsl:stylesheet'}.(XML.Attribute)id;
IF LASTMOVE(styleSheetID) = TRUE THEN
SET OutputRoot.XML.(XML.ProcessingInstruction)"xml-stylesheet" = 'type="text/xsl" href="#' || styleSheetID || '"';
SET OutputRoot.XML.Contact.{'xsl:stylesheet'} = styleSheet.{'xsl:stylesheet'};
END IF; _________________ Regards,
-XZ
WMQI Development |
|
Back to top |
|
 |
mgk |
Posted: Tue May 23, 2006 12:51 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hi, this is a bad idea from a performance point of view. Don't use EVAL for dynamic DB work, use PASSTHRU with a parameter markers (?).
Quote: |
SET stylesheet = EVAL('SELECT T.c1 FROM Database.kevin.emp AS T WHERE T.c = ' || 'xyz'); |
Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
hascheidl |
Posted: Wed Jun 07, 2006 6:35 am Post subject: stylesheet not found exception |
|
|
Novice
Joined: 05 Jun 2006 Posts: 15
|
Code: |
SET OutputRoot = InputRoot;
DECLARE styleSheetID REFERENCE TO styleSheet.{'xsl:stylesheet'}.(XML.Attribute)id;
IF LASTMOVE(styleSheetID) = TRUE THEN
SET OutputRoot.XML.(XML.ProcessingInstruction)"xml-stylesheet" = 'type="text/xsl" href="#' || styleSheetID || '"';
SET OutputRoot.XML.Contact.{'xsl:stylesheet'} = styleSheet.{'xsl:stylesheet'};
END IF; |
Does it really work? I've got a "style sheet not found" exception in the XML transform node. Do you have any sugestion? _________________ Half |
|
Back to top |
|
 |
hascheidl |
Posted: Wed Jun 07, 2006 7:02 am Post subject: Exception description |
|
|
Novice
Joined: 05 Jun 2006 Posts: 15
|
Thats the exception I`ve got.
Code: |
( WBIBK.default ) The method 'evaluate' in Java node 'XMLTransformation' has thrown the following exception: <com.ibm.broker.plugin.MbRecoverableException class:com.ibm.xsl.mqsi.XMLTransformData method:transformData source:com.ibm.xsl.mqsi.XMLTransformResources key:Error_Transformmessage: [com.ibm.xsl.mqsi.XMLTransformResources:Error_Transform]Error: Could not transform data:
com.ibm.xsl.exmlt.TransformRequestException: Stylesheet not found
Stylesheet not found
com.ibm.xsl.exmlt.TransformRequestException: Stylesheet not found
at com.ibm.xsl.exmlt.EnhancedXMLTransform.transformDocument(EnhancedXMLTransform.java:744)
at com.ibm.xsl.mqsi.XMLTransformData.transformData(XMLTransformData.java:725)
at com.ibm.xsl.mqsi.XMLTransformNode.evaluate(XMLTransformNode.java:877)
>.
The method 'evaluate' of the Java plug-in node has thrown an exception. Examine previous error messages for details of the cause of the problem.
Contact the node provider for further details. |
_________________ Half |
|
Back to top |
|
 |
XZ |
Posted: Wed Jun 07, 2006 7:32 am Post subject: |
|
|
 Apprentice
Joined: 22 May 2006 Posts: 45 Location: IBM Hursley
|
What does the output message from your Computter node look like?
Suppose your oringinal message looks like
<?xml version="1.0"?>
<YourMessageBody>
<!-- Your original message -->
...
</YourMessageBody>>
What your computeNode needs to do is to create a XML message which has the following structure:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xml" href="#style1"?>
<YourMessageBody>
<!-- Your original message -->
...
<!-- Inserted style sheet -->
<xsl:stylesheet id="style1" version="1.0" ...>
...
</xsl:stylesheet>
</YourMessageBody>
The ESQL assumes that your original stylesheet has an id attribute and the
DECLARE styleSheetID REFERENCE TO styleSheet.{'xsl:stylesheet'}.(XML.Attribute)id;
statement should enable you to extract the value of the id. The actual value does not have to be "style1".
The
SET OutputRoot.XML.(XML.ProcessingInstruction)"xml-stylesheet" = 'type="text/xsl" href="#' || styleSheetID || '"';
statement should then generate the
<?xml-stylesheet type="text/xml" href="#style1"?>
line.
The
SET OutputRoot.XML.Contact.{'xsl:stylesheet'} = styleSheet.{'xsl:stylesheet'};
should then insert your style sheet into your message body. I assumed that your message body would be labelled as <Contact>. You should replace "Contact" in the statement with whatever your message label is (Sorry for not making that clear earlier).
Another point, your style sheet need to contain the following line if you
don't want your style sheet to appear in your transformed message:
<xsl:template match="xsl:stylesheet"/>.
Let me know if you still have problems. _________________ Regards,
-XZ
WMQI Development |
|
Back to top |
|
 |
|