Hi
I want to use matches function which comes in XSLT 2.0 . I used like below :
<xsl:when test='not(matches(/COD/CONTENT/SP_WORKFLOW/ORIGPUBDATE,"[0-9]{4}/[0-9]{2}/[0-9]{2}"))'>
its comparing a date format to regex.
I wrote on
Java XSLT transformation code for this using SAXON 9
public static void main(
String args[]) {
// set the TransformFactory to use the Saxon TransformerFactoryImpl method
System.setProperty("javax.xml.transform.TransformerFactory",
"net.sf.saxon.TransformerFactoryImpl");
String foo_xml = "inputxml_xml"; //input xml
String foo_xsl = "input_xsl"; //input xsl
try {
myTransformer (foo_xml, foo_xsl);
}
catch (Exception ex) {
ex.printStackTrace();
}
}
public static void myTransformer (String sourceID, String xslID)
throws TransformerException, TransformerConfigurationException, UnsupportedEncodingException, FileNotFoundException {
InputStreamReader reader = new InputStreamReader(
new FileInputStream("input_xml"), "UTF-8");
Source xmlSource = new StreamSource(reader);
System.out.println("reader encoding == " + reader.getEncoding());
Source xsltSource = new StreamSource(new InputStreamReader(
new FileInputStream("input_xsl"), "UTF-8"));
// Create a transform factory instance.
TransformerFactory tfactory = TransformerFactoryImpl.newInstance();
OutputStreamWriter writer = new OutputStreamWriter(
new FileOutputStream("output_xml"), "UTF-8");
Result result = new StreamResult(writer);
// Create a transformer for the stylesheet.
Transformer transformer = tfactory.newTransformer(xsltSource);
// Transform the source XML to System.out.
transformer.transform(xmlSource, result);
}
But the functionality of matches is not working...
Please help me in this matter.