We are using xslt for one of the xml transformation. we have a requirement to generate a random id for one of the element during xslt translation.So, I need to call a java service inside xslt to get that value.
could you please suggest how to acheive this?
Hi Vignesh,
I don´t think that this will be possible.
I would suggest to call the java service before the xslt step and then use the outcome of this service inside the xslt transformation.
Regards,
Holger
Hi @vignesh.govindhan ,
Found an old thread that tries to do the same but wasn’t supported . Using WmPublic functions inside xslt stylesheet - #5 by Deltones
Please note that I haven’t tried this , but the XSLT example in the Service Development help guide clearly shows how to call java methods (not java services) from inside an XSLT, refer guide at https://documentation.softwareag.com/webmethods/designer/sdf10-5/10-5_Service_Development_Help.pdf page 380 to 385.
E.g, xmlns:Date="java.util.Date" and use it by calling <xsl:value-of select="Date:toString($date)"/>
(page 383)
If your intention is to generate a random id , you can check the javadoc for UUID (Java Platform SE 7 ) and see if this meets your purpose.
Hope this helps,
NP
P.S: A good discussion about its reliability is at How good is Java's UUID.randomUUID? - Stack Overflow
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.