View Single Post
  #1 (permalink)  
Old June 7th, 2018, 02:50 AM
Flamengo Flamengo is offline
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2018
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Exclamation Call external .class on Saxon 9HE Processor XSLT

Hi Guys,

I really need some help. I have a requirement to make Luhn Algorithm in one tag of the input XML.

I really could not find anything clear on pure XSLT code, but I already developed a java code and I just need to call it on XSLT.

I'm using the processor SAXON 9HE because also from input XML I need slipt into many output XML's.

As I mentioned before this tag on XML that I need use LUHN Algoritm input xml (This is just sample, the input XML and Java it's big to post here):

<?xml version="1.0" encoding="UTF-8"?>
<tag>urn:epc:id:sgtin:0614141.100013.00000000000 1</tag>

I have the java code read:

public class Luhn {
public static String LuhnAlgorithm(String card) {

The code is runing perfect but now I need call the function LuhnAlgorithm inside XSLT to make the transformation:

<xsl:stylesheet version="2.0" xmlns:xsl="" xmlns:java="java:sumCheck.Luhn">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:template match="/">
<xsl:variable name="Luhn13Digits"
select="translate(concat('0',substring(.,19,13 )),'.','')"/>
<xsl:value-of select="java:LuhnAlgorithm($Luhn13Digits)"/>

Any Help I really appreciate. Thanks for your attention.

Kind Regards,

Reply With Quote