ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » XML Transformation Node and Functions

Post new topic  Reply to topic
 XML Transformation Node and Functions « View previous topic :: View next topic » 
Author Message
Janice_Shania
PostPosted: Mon Sep 25, 2006 8:39 am    Post subject: XML Transformation Node and Functions Reply with quote

Novice

Joined: 25 Sep 2006
Posts: 12

Hi,

I am trying out the XML Transformation Node in WMB and want to know what support has been provided for use of functions.

Since it is based on XSLT 1.0, i believe that normal <xsl:funtions> will not be supported.

However are exslt functions supported?
I tried an example, but it does not seem to work,

Any help will be greatly appreciated.

Thanx
Janice
Back to top
View user's profile Send private message
XZ
PostPosted: Tue Sep 26, 2006 12:51 am    Post subject: Reply with quote

Apprentice

Joined: 22 May 2006
Posts: 45
Location: IBM Hursley

Hi Janice,

You can find the information from http://w3.xml.ibm.com/xsl/java/dist/xslt4j-2_6_9/docs/extensionslib.html. Be aware that XSLTC has more limitations.
_________________
Regards,

-XZ
WMQI Development
Back to top
View user's profile Send private message
Janice_Shania
PostPosted: Tue Sep 26, 2006 2:00 am    Post subject: XML Transformation Node and Functions Reply with quote

Novice

Joined: 25 Sep 2006
Posts: 12

Hi XZ,

The site does not open, please could you confirm the URL.

Also, are you aware of any successful implementation of such functions being implemented?

Please could you let me know. Its a little urgent. Since my code has a number of reusable sections of code, and i really wanna get hold of functions of some sory.

Thanks in advance,
Janice
Back to top
View user's profile Send private message
XZ
PostPosted: Tue Sep 26, 2006 3:25 am    Post subject: Reply with quote

Apprentice

Joined: 22 May 2006
Posts: 45
Location: IBM Hursley

Oh, my apology for giving you an IBM internal page. Could you please try this one -> http://xml.apache.org/xalan-j/extensionslib.html?
_________________
Regards,

-XZ
WMQI Development
Back to top
View user's profile Send private message
Janice_Shania
PostPosted: Tue Sep 26, 2006 7:53 am    Post subject: Reply with quote

Novice

Joined: 25 Sep 2006
Posts: 12

Hi,
I tried the extensible style sheets too.
They dont seem to work.
has anyone got a hand over these?
please could an example be posted...


Thanks
Janice
Back to top
View user's profile Send private message
Janice_Shania
PostPosted: Wed Sep 27, 2006 12:53 am    Post subject: Reply with quote

Novice

Joined: 25 Sep 2006
Posts: 12

Hi XZ,
I tried this example in WMB, but it fails to work. The error message that is displayed is not very helpful: [b]Transformation failure when processing Stylesheet deployed:./func.function.1.xsl
The stylesheet could not be processed: deployed:[/b]

The style sheet is as follows.

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:math="http://exslt.org/math"
xmlns:func="http://exslt.org/functions"
exclude-result-prefixes="func">

<xsl:template match="/">
<Result>
<xsl:value-of select="func:testfunction(//Test)"/>
</Result>
</xsl:template>

<func:function name="func:testfunction">
<xsl:param name="inputString"/>
<func:result select="//Two" />
</func:function>
</xsl:stylesheet>

When i replce the call to the function with a math-function is exslt, like math:sin(3.14), it works fine in WMB.
Please could you advice.

Regards,
Janice
Back to top
View user's profile Send private message
Janice_Shania
PostPosted: Wed Sep 27, 2006 12:56 am    Post subject: XML Transformation Node and Functions Reply with quote

Novice

Joined: 25 Sep 2006
Posts: 12

Additionally, i would like to add, that the transformation works well in XML editor in WMB. However, when used as a part of the flow, using the XML Transformation Node, it fails.

Thanks,
Janice
Back to top
View user's profile Send private message
XZ
PostPosted: Wed Sep 27, 2006 2:37 am    Post subject: Reply with quote

Apprentice

Joined: 22 May 2006
Posts: 45
Location: IBM Hursley

Janice,

It looks that you have hit a limitation of Xalan compiler (interpreter is ok with your style sheet). It reported the following exception:
Quote:
ERROR: 'The first argument to the non-static Java function 'testfunction' is no
t a valid object reference.'
FATAL ERROR: 'Could not compile stylesheet'
javax.xml.transform.TransformerConfigurationException: Could not compile stylesh
eet
at org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTemplates(Trans
formerFactoryImpl.java:778)
at org.apache.xalan.xsltc.trax.SmartTransformerFactoryImpl.newTemplates(
SmartTransformerFactoryImpl.java:252)
at CompilerTest.main(CompilerTest.java:22)

The XMLT node compiles your style sheet if your cache level > 0. You can avoid your style sheet being compiled by setting your cache level to 0 (may have a performance hit).

Otherwise, would the following style solve your problem?
Quote:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:math="http://exslt.org/math"
xmlns:func="http://exslt.org/functions"
exclude-result-prefixes="func">

<xsl:template match="/">
<Result>
<xsl:call-template name="testfunction">
<xsl:with-param name="inputString" select="//Test"/>
</xsl:call-template>
</Result>
</xsl:template>

<xsl:template name="testfunction">
<xsl:param name="inputString"/>
<xsl:param name="result" select="//Two" />
</xsl:template>
</xsl:stylesheet>

_________________
Regards,

-XZ
WMQI Development
Back to top
View user's profile Send private message
Janice_Shania
PostPosted: Wed Sep 27, 2006 3:10 am    Post subject: XML Transformation Node and Functions Reply with quote

Novice

Joined: 25 Sep 2006
Posts: 12

Hi XZ,

Cheers!!

Both the approaches that you suggested worked well. As you say, due to performance hit..i would rather go with the "<xsl:call-template" approach.

Thanx a million,
Janice
:D
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » XML Transformation Node and Functions
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.