XSLT calls Java

Source: Internet
Author: User
Tags xsl xslt

XSLT Call JS http://www.ibm.com/developerworks/cn/xml/tips/x-tipxsltjs/index.html
XSLT calls Java Http://unmi.cc/xslt-call-java-method

Java code
  1. Package Org.lvsenlin;
  2. Import Java.text.SimpleDateFormat;
  3. Import Java.util.Random;
  4. Public class Xsltfunctions {
  5. public static int re_int (int a) {
  6. return A;
  7. }
  8. public static int re_random (int a) {
  9. int r=new Random (). Nextint (10000);
  10. return R;
  11. }
  12. public static string Timestampdate (String timestampstring) {
  13. String date = new SimpleDateFormat ("YYYY-MM-DD"). Format (Long.parselong (timestampstring));
  14. return date;
  15. }
  16. public static void Main (string[] args) {
  17. String date = timestampdate ("1322755200000");
  18. SYSTEM.OUT.PRINTLN (date);
  19. }
  20. }
Package Org.lvsenlin;import Java.text.simpledateformat;import Java.util.Random; public class Xsltfunctions {public    static int re_int (int a) {        return A;    }    public static int Re_random (int a) {    int r=new random (). Nextint (10000); return r;    }    public static string Timestampdate (String timestampstring) {        string date = new SimpleDateFormat ("Yyyy-mm-dd"). Format (Long.parselong (timestampstring));    return date;}       public static void Main (string[] args) {    String date = timestampdate ("1322755200000");    SYSTEM.OUT.PRINTLN (date);}}

<?xml version= "1.0" encoding= "UTF-8"?>

XML code
  1. <xsl:stylesheet version="1.0"
  2. xmlns:xsl="Http://www.w3.org/1999/XSL/Transform"
  3. xmlns:java="Org.lvsenlin"
  4. exclude-result-prefixes="java">
  5. <xsl:template match="/">
  6. <msc type="form">
  7. <body>
  8. <xsl:value-of select=' java:XsltFunctions.TimeStampDate ("1322755200000") ' />
  9. </Body>
  10. </msc>
  11. </xsl:template>
  12. </xsl:stylesheet>

XSLT calls Java

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.