Create a “Current Date” Extension Element for Xalan

Create a “Current Date” Extension Element for Xalan

This tip is just a small application that creates an extension element for the Xalan processor. The name of the new element is &lttoday&gt and it can be used to access the current date. After the application code, there’s a small XSL stylesheet that uses this element.

//Java codepackage xslt.extension.myelement;import java.util.Calendar;public class MyExtension{   public String today(org.apache.xalan.extensions.XSLProcessorContext XSLPC,    org.apache.xalan.templates.ElemExtensionCall EEC)    {    String[] luni={"January","February","March",                    "April","May","June","July","August",                   "September","October","November","December"};          Calendar C=Calendar.getInstance();    String luna=luni[C.get(Calendar.MONTH)];    String data=String.valueOf(C.get(Calendar.DATE));    String an=String.valueOf(C.get(Calendar.YEAR));          return (data+"."+luna+"."+an);    }      }//XSL stylesheet<?xml version="1.0" encoding="UTF-8"?>           	        		         	 			                        Today:      	        

Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved