From 6fa9860667a80c65ffaabc695ec7f67ef6c5bc39 Mon Sep 17 00:00:00 2001 From: Innovimax Date: Tue, 17 Jan 2017 10:42:50 +0100 Subject: [PATCH 1/2] Update to Saxon 9.7 --- .../xslt/tests/XSLTCoverageTraceListener.java | 335 ++++++++++-------- 1 file changed, 182 insertions(+), 153 deletions(-) diff --git a/java/com/jenitennison/xslt/tests/XSLTCoverageTraceListener.java b/java/com/jenitennison/xslt/tests/XSLTCoverageTraceListener.java index b95de46b5..45fee57fc 100644 --- a/java/com/jenitennison/xslt/tests/XSLTCoverageTraceListener.java +++ b/java/com/jenitennison/xslt/tests/XSLTCoverageTraceListener.java @@ -1,18 +1,19 @@ /****************************************************************************/ /* File: XSLTCoverageTraceListener.java */ /* Author: Jeni Tennsion */ -/* URI: http://xspec.googlecode.com/ */ +/* URI: https://github.com/innovimax/xspec */ /* Tags: */ -/* Copyright (c) 2008, 2010 (see end of file.) */ +/* Copyright (c) 2008, 2010, 2017 (see end of file.) */ /* ------------------------------------------------------------------------ */ - package com.jenitennison.xslt.tests; -import net.sf.saxon.trace.TraceListener; import net.sf.saxon.trace.InstructionInfo; -import net.sf.saxon.trace.Location; +import net.sf.saxon.trace.LocationKind; +import net.sf.saxon.Controller; import net.sf.saxon.expr.XPathContext; +import net.sf.saxon.lib.Logger; +import net.sf.saxon.lib.TraceListener; import net.sf.saxon.om.Item; import net.sf.saxon.om.StandardNames; import java.lang.String; @@ -21,160 +22,187 @@ import java.io.PrintStream; /** - * A Simple trace listener for XSLT that writes messages (by default) to System.err + * A Simple trace listener for XSLT that writes messages (by default) to + * System.err */ public class XSLTCoverageTraceListener implements TraceListener { - private PrintStream out = System.err; - private String xspecStylesheet = null; - private String utilsStylesheet = null; - private HashMap modules = new HashMap(); - private HashSet constructs = new HashSet(); - private int moduleCount = 0; - - /** - * Method called at the start of execution, that is, when the run-time transformation starts - */ - - public void open() { - out.println(""); - } - - /** - * Method called at the end of execution, that is, when the run-time execution ends - */ - - public void close() { - out.println(""); - } - - /** - * Method that is called when an instruction in the stylesheet gets processed. - * @param instruction gives information about the instruction being - * executed, and about the context in which it is executed. This object is mutable, - * so if information from the InstructionInfo is to be retained, it must be copied. - */ - - public void enter(InstructionInfo info, XPathContext context) { - int lineNumber = info.getLineNumber(); - String systemId = info.getSystemId(); - int constructType = info.getConstructType(); - if (utilsStylesheet == null && - systemId.indexOf("generate-tests-utils.xsl") != -1) { - utilsStylesheet = systemId; - out.println(""); - } else if (xspecStylesheet == null && - systemId.indexOf("/xspec/") != -1) { - xspecStylesheet = systemId; - out.println(""); - } - if (systemId != xspecStylesheet && systemId != utilsStylesheet) { - Integer module; - if (modules.containsKey(systemId)) { - module = (Integer)modules.get(systemId); - } else { - module = new Integer(moduleCount); - moduleCount += 1; - modules.put(systemId, module); - out.println(""); - } - if (!constructs.contains(constructType)) { - String construct; - if (constructType < 1024) { - construct = StandardNames.getClarkName(constructType); - } else { - switch (constructType) { - case Location.LITERAL_RESULT_ELEMENT: - construct = "LITERAL_RESULT_ELEMENT"; - break; - case Location.LITERAL_RESULT_ATTRIBUTE: - construct = "LITERAL_RESULT_ATTRIBUTE"; - break; - case Location.EXTENSION_INSTRUCTION: - construct = "EXTENSION_INSTRUCTION"; - break; - case Location.TEMPLATE: - construct = "TEMPLATE"; - break; - case Location.FUNCTION_CALL: - construct = "FUNCTION_CALL"; - break; - case Location.BUILT_IN_TEMPLATE: - construct = "BUILT_IN_TEMPLATE"; - break; - case Location.XPATH_IN_XSLT: - construct = "XPATH_IN_XSLT"; - break; - case Location.LET_EXPRESSION: - construct = "LET_EXPRESSION"; - break; - case Location.TRACE_CALL: - construct = "TRACE_CALL"; - break; - case Location.SAXON_EVALUATE: - construct = "SAXON_EVALUATE"; - break; - case Location.FUNCTION: - construct = "FUNCTION"; - break; - case Location.XPATH_EXPRESSION: - construct = "XPATH_EXPRESSION"; - break; - default: - construct = "Other"; - } - } - constructs.add(constructType); - out.println(""); - } - out.println(""); - } - } - - /** - * Method that is called after processing an instruction of the stylesheet, - * that is, after any child instructions have been processed. - * @param instruction gives the same information that was supplied to the - * enter method, though it is not necessarily the same object. Note that the - * line number of the instruction is that of the start tag in the source stylesheet, - * not the line number of the end tag. - */ - - public void leave(InstructionInfo instruction) { - // Do nothing - } - - /** - * Method that is called by an instruction that changes the current item - * in the source document: that is, xsl:for-each, xsl:apply-templates, xsl:for-each-group. - * The method is called after the enter method for the relevant instruction, and is called - * once for each item processed. - * @param currentItem the new current item. Item objects are not mutable; it is safe to retain - * a reference to the Item for later use. - */ - - public void startCurrentItem(Item currentItem) { - // Do nothing - } - - /** - * Method that is called when an instruction has finished processing a new current item - * and is ready to select a new current item or revert to the previous current item. - * The method will be called before the leave() method for the instruction that made this - * item current. - * @param currentItem the item that was current, whose processing is now complete. This will represent - * the same underlying item as the corresponding startCurrentItem() call, though it will - * not necessarily be the same actual object. - */ - - public void endCurrentItem(Item currentItem) { - // Do nothing - } + private PrintStream out = System.err; + private String xspecStylesheet = null; + private String utilsStylesheet = null; + private HashMap modules = new HashMap(); + private HashSet constructs = new HashSet(); + private int moduleCount = 0; + + /** + * Method called at the start of execution, that is, when the run-time + * transformation starts + */ + + public void open() { + this.out.println(""); + } + + /** + * Method called at the end of execution, that is, when the run-time + * execution ends + */ + + @Override + public void close() { + this.out.println(""); + } + + /** + * Method that is called when an instruction in the stylesheet gets + * processed. + * + * @param instruction + * gives information about the instruction being executed, and + * about the context in which it is executed. This object is + * mutable, so if information from the InstructionInfo is to be + * retained, it must be copied. + */ + + @Override + public void enter(InstructionInfo info, XPathContext context) { + int lineNumber = info.getLineNumber(); + String systemId = info.getSystemId(); + int constructType = info.getConstructType(); + if (this.utilsStylesheet == null && systemId.indexOf("generate-tests-utils.xsl") != -1) { + this.utilsStylesheet = systemId; + this.out.println(""); + } else if (this.xspecStylesheet == null && systemId.indexOf("/xspec/") != -1) { + this.xspecStylesheet = systemId; + this.out.println(""); + } + if (systemId != this.xspecStylesheet && systemId != this.utilsStylesheet) { + Integer module; + if (this.modules.containsKey(systemId)) { + module = this.modules.get(systemId); + } else { + module = new Integer(this.moduleCount); + this.moduleCount += 1; + this.modules.put(systemId, module); + this.out.println(""); + } + if (!this.constructs.contains(constructType)) { + String construct; + if (constructType < 1024) { + construct = StandardNames.getClarkName(constructType); + } else { + switch (constructType) { + case LocationKind.LITERAL_RESULT_ELEMENT: + construct = "LITERAL_RESULT_ELEMENT"; + break; + case LocationKind.LITERAL_RESULT_ATTRIBUTE: + construct = "LITERAL_RESULT_ATTRIBUTE"; + break; + case LocationKind.EXTENSION_INSTRUCTION: + construct = "EXTENSION_INSTRUCTION"; + break; + case LocationKind.TEMPLATE: + construct = "TEMPLATE"; + break; + case LocationKind.FUNCTION_CALL: + construct = "FUNCTION_CALL"; + break; + // case LocationKind.BUILT_IN_TEMPLATE: + // construct = "BUILT_IN_TEMPLATE"; + // break; + case LocationKind.XPATH_IN_XSLT: + construct = "XPATH_IN_XSLT"; + break; + case LocationKind.LET_EXPRESSION: + construct = "LET_EXPRESSION"; + break; + case LocationKind.TRACE_CALL: + construct = "TRACE_CALL"; + break; + case LocationKind.SAXON_EVALUATE: + construct = "SAXON_EVALUATE"; + break; + case LocationKind.FUNCTION: + construct = "FUNCTION"; + break; + case LocationKind.XPATH_EXPRESSION: + construct = "XPATH_EXPRESSION"; + break; + default: + construct = "Other"; + } + } + this.constructs.add(constructType); + this.out.println(""); + } + this.out.println(""); + } + } + + /** + * Method that is called after processing an instruction of the stylesheet, + * that is, after any child instructions have been processed. + * + * @param instruction + * gives the same information that was supplied to the enter + * method, though it is not necessarily the same object. Note + * that the line number of the instruction is that of the start + * tag in the source stylesheet, not the line number of the end + * tag. + */ + + @Override + public void leave(InstructionInfo instruction) { + // Do nothing + } + + /** + * Method that is called by an instruction that changes the current item in + * the source document: that is, xsl:for-each, xsl:apply-templates, + * xsl:for-each-group. The method is called after the enter method for the + * relevant instruction, and is called once for each item processed. + * + * @param currentItem + * the new current item. Item objects are not mutable; it is safe + * to retain a reference to the Item for later use. + */ + + @Override + public void startCurrentItem(Item currentItem) { + // Do nothing + } + + /** + * Method that is called when an instruction has finished processing a new + * current item and is ready to select a new current item or revert to the + * previous current item. The method will be called before the leave() + * method for the instruction that made this item current. + * + * @param currentItem + * the item that was current, whose processing is now complete. + * This will represent the same underlying item as the + * corresponding startCurrentItem() call, though it will not + * necessarily be the same actual object. + */ + + @Override + public void endCurrentItem(Item currentItem) { + // Do nothing + } + + @Override + public void open(Controller arg0) { + // Do nothing + } + + @Override + public void setOutputDestination(Logger arg0) { + // Do nothing + } } - // // The contents of this file are subject to the Mozilla Public License // Version 1.0 (the "License"); you may not use this file except in @@ -195,5 +223,6 @@ public void endCurrentItem(Item currentItem) { // All Rights Reserved. // // Contributor(s): Heavily modified by Michael Kay -// Methods implemented by Jeni Tennison +// updated to Saxon 9.7 by Mohamed Zergaoui (Innovimax) +// Methods implemented by Jeni Tennison // From fff4f41e271c42e2d435de219f156c8ed961b818 Mon Sep 17 00:00:00 2001 From: Innovimax Date: Tue, 17 Jan 2017 10:43:47 +0100 Subject: [PATCH 2/2] binary compiled for old saxon version removed --- .../xslt/tests/XSLTCoverageTraceListener.class | Bin 3334 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 java/com/jenitennison/xslt/tests/XSLTCoverageTraceListener.class diff --git a/java/com/jenitennison/xslt/tests/XSLTCoverageTraceListener.class b/java/com/jenitennison/xslt/tests/XSLTCoverageTraceListener.class deleted file mode 100644 index aecafafbf799b96b1267fb33587e6beda1e24150..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3334 zcma)8TW}j!8UBtXdDrsBi8oOaLoTkYwbqUuTAa1Cw&lnx zceQfuQlMN*3zS>$4Wy(^(>4^^65B~L6owg6V0h>Z1BG&#;ei<*nBkchhVQKGSc;V? z4|~3|=lu8E?r;A4_B#Of;O!s|VyFfu@W~pq<6gPkCznqt7!IOZ-nHYT0yBu3;>(CU zNvTK&VPRCoSS`kpk;{Z!PN~QS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