首页 > 代码库 > XSLT 调用java
XSLT 调用java
XSLT调用JS http://www.ibm.com/developerworks/cn/xml/tips/x-tipxsltjs/index.html
XSLT调用JAVA http://unmi.cc/xslt-call-java-method
Java代码
- 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);
- }
- }
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代码
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:java="org.lvsenlin"
- exclude-result-prefixes="java">
- <xsl:template match="/">
- <msc type="form">
- <body>
- <xsl:value-of select=‘java:XsltFunctions.TimeStampDate("1322755200000")‘ />
- </body>
- </msc>
- </xsl:template>
- </xsl:stylesheet>
XSLT 调用java
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。