Skip to content

Commits on Source 3

saxonhe (9.9.1.5+dfsg-1) unstable; urgency=medium
* New upstream release.
* Bump Standards-Version to 4.4.1 (no changes)
-- Eugene Zhukov <eugene@debian.org> Mon, 09 Dec 2019 13:39:03 +0200
saxonhe (9.9.1.1+dfsg-1) unstable; urgency=medium
* New upstream release.
......
#!/bin/sh -e
VERSION=$2
VERSION=$1
TAR=../saxonhe_$VERSION+dfsg.orig.tar.xz
DIR=saxonhe-$VERSION
TAG="$VERSION"
......
......@@ -8,7 +8,7 @@ Description: Add pom.xml for building and packaging
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>Saxon-HE</artifactId>
+ <version>9.9.1.1</version>
+ <version>9.9.1.5</version>
+ <packaging>jar</packaging>
+ <name>Saxon-HE</name>
+ <description>The XSLT and XQuery Processor</description>
......
......@@ -418,8 +418,8 @@ public class Configuration implements SourceResolver, NotationSet {
/**
* Factory method to construct a Configuration object by reading a configuration file.
* This version of the method creates a configuration that is "compatible" with the
* supplied configuration, in that it shares the same NamePool and DocumentNumberAllocator.
* (This is used by fn:transform)
* supplied configuration, in that it shares the same NamePool and DocumentNumberAllocator,
* and also the same licensing details. (This is used by fn:transform)
*
* @param source Source object containing the configuration file
* @param baseConfiguration an existing configuration whose NamePool and DocumentNumberAllocator
......@@ -1600,7 +1600,7 @@ public class Configuration implements SourceResolver, NotationSet {
}
if (collationName.startsWith(AlphanumericCollator.PREFIX)) {
return new AlphanumericCollator(getCollation(
collationName.substring(0, AlphanumericCollator.PREFIX.length())));
collationName.substring(AlphanumericCollator.PREFIX.length())));
}
StringCollator collator = collationMap.get(collationName);
if (collator == null) {
......@@ -3953,6 +3953,10 @@ public class Configuration implements SourceResolver, NotationSet {
throw new UnsupportedOperationException();
}
public Expression makeObjectLookupExpression(Expression lhs, Expression rhs) {
throw new UnsupportedOperationException();
}
/**
* Get a NodeInfo corresponding to a DOM or other external Node,
* either by wrapping or unwrapping the external Node.
......@@ -4649,7 +4653,7 @@ public class Configuration implements SourceResolver, NotationSet {
case FeatureCode.SERIALIZER_FACTORY_CLASS:
setSerializerFactory(
(SerializerFactory) instantiateClassName(name, value, OutputURIResolver.class));
(SerializerFactory) instantiateClassName(name, value, SerializerFactory.class));
break;
case FeatureCode.SCHEMA_VALIDATION: {
......@@ -5275,7 +5279,7 @@ public class Configuration implements SourceResolver, NotationSet {
SpaceStrippingRule rule = getParseOptions().getSpaceStrippingRule();
if (rule == AllElementsSpaceStrippingRule.getInstance()) {
return (T) "all";
} else if (rule == IgnorableSpaceStrippingRule.getInstance()) {
} else if (rule == null || rule == IgnorableSpaceStrippingRule.getInstance()) {
return (T) "ignorable";
} else {
return (T) "none";
......
......@@ -368,6 +368,12 @@ public class Controller implements ContextOriginator {
return new SequenceOutputter(pipe, size);
}
/*@NotNull*/
public synchronized SequenceOutputter allocateSequenceOutputter() {
PipelineConfiguration pipe = makePipelineConfiguration();
return new SequenceOutputter(pipe, 20);
}
///////////////////////////////////////////////////////////////////////////////
/**
......@@ -491,17 +497,6 @@ public class Controller implements ContextOriginator {
return executable;
}
/**
* Get the KeyManager.
* <p>This method is intended for internal use only.</p>
*
* @return the KeyManager, which holds details of all key declarations
*/
public KeyManager getKeyManager() {
return executable.getKeyManager();
}
/**
* Get the document pool. This is used only for source documents, not for stylesheet modules.
* <p>This method is intended for internal use only.</p>
......
......@@ -78,6 +78,15 @@ public interface Platform {
XMLReader loadParser();
/**
* Get a parser by instantiating the SAXParserFactory
*
* @return the parser (XMLReader)
*/
XMLReader loadParserForXmlFragments();
/**
* Convert a StreamSource to either a SAXSource or a PullSource, depending on the native
* parser of the selected platform
......@@ -246,7 +255,7 @@ public interface Platform {
ModuleURIResolver makeStandardModuleURIResolver(Configuration config);
//#if EE==true
//#if BYTECODE==true
/**
* Return the class loader required to load the bytecode generated classes
*
......
......@@ -20,10 +20,7 @@ import net.sf.saxon.serialize.SerializationProperties;
import net.sf.saxon.style.Compilation;
import net.sf.saxon.style.StylesheetPackage;
import net.sf.saxon.trace.ExpressionPresenter;
import net.sf.saxon.trans.CompilerInfo;
import net.sf.saxon.trans.SymbolicName;
import net.sf.saxon.trans.XPathException;
import net.sf.saxon.trans.XsltController;
import net.sf.saxon.trans.*;
import net.sf.saxon.trans.rules.RuleManager;
import java.net.URI;
......@@ -253,6 +250,61 @@ public class PreparedStylesheet extends Executable {
return componentIndex.get(name);
}
/**
* Ask whether a component is invokable from outside the stylesheet
*
* @param component the component
* @return true if the component can be referenced from the calling application
*/
public boolean isEligibleInitialComponent(Component component) {
if (component == null) {
return false;
}
if (component.getVisibility() == Visibility.PUBLIC || component.getVisibility() == Visibility.FINAL) {
return true;
}
StylesheetPackage top = getTopLevelPackage();
if (top.isImplicitPackage() && component.getActor().getDeclaredVisibility() == null) {
return true;
}
return false;
}
/**
* Ask whether a mode is eligible for invoking from outside the stylesheet
*
* @param component the component
* @return true if the component can be referenced from the calling application
*/
public boolean isEligibleInitialMode(Component.M component) {
if (component == null) {
return false;
}
// Rules 1 and 4
if (component.getVisibility() == Visibility.PUBLIC || component.getVisibility() == Visibility.FINAL) {
return true;
}
// Rule 2
if (component.getActor().isUnnamedMode()) {
return true;
}
// Rule 3
StylesheetPackage top = getTopLevelPackage();
if (component.getActor().getModeName().equals(top.getDefaultMode())) {
return true;
}
// Rule 5 (but see also bug 30405)
if (!top.isDeclaredModes() && !component.getActor().isEmpty() &&
(component.getVisibilityProvenance() == VisibilityProvenance.DEFAULTED || component.getVisibility() != Visibility.PRIVATE)) {
return true;
}
return false;
}
/**
* Iterate over all the named templates defined in this Executable
*
......@@ -369,7 +421,6 @@ public class PreparedStylesheet extends Executable {
presenter.startElement("stylesheet");
presenter.namespace("fn", NamespaceConstant.FN);
presenter.namespace("xs", NamespaceConstant.SCHEMA);
getKeyManager().exportKeys(presenter, null);
explainGlobalVariables(presenter);
ruleManager.explainTemplateRules(presenter);
explainNamedTemplates(presenter);
......
......@@ -442,7 +442,7 @@ public class Query {
}
if (repeat < 100) {
System.err.println("Execution time: " + CommandLineOptions.showExecutionTimeNano(endTime - startTime));
System.err.println("Memory used: " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
System.err.println("Memory used: " + CommandLineOptions.showMemoryUsed());
} else if (totalTime > 1000000000000L) {
// quit after 1000 seconds
break;
......@@ -712,7 +712,8 @@ public class Query {
}
} else if (sourceFileName.equals("-")) {
// take input from stdin
sourceInput = new StreamSource(System.in);
String sysID = new File(System.getProperty("user.dir")).toURI().toASCIIString();
sourceInput = new StreamSource(System.in, sysID);
} else {
File sourceFile = new File(sourceFileName);
if (!sourceFile.exists()) {
......@@ -721,6 +722,8 @@ public class Query {
if (Version.platform.isJava()) {
InputSource eis = new InputSource(sourceFile.toURI().toString());
// String sysID = new File(System.getProperty("user.dir")).toURI().toASCIIString();
// eis.setSystemId(sysID);
sourceInput = new SAXSource(eis);
} else {
sourceInput = new StreamSource(sourceFile.toURI().toString());
......@@ -746,6 +749,7 @@ public class Query {
XQueryExecutable exp;
if (queryFileName.equals("-")) {
Reader queryReader = new InputStreamReader(System.in);
compiler.setBaseURI(new File(System.getProperty("user.dir")).toURI());
exp = compiler.compile(queryReader);
} else if (queryFileName.startsWith("{") && queryFileName.endsWith("}")) {
// query is inline on the command line
......@@ -1061,7 +1065,7 @@ public class Query {
System.err.println(config.getProductTitle());
}
System.err.println("Usage: see http://www.saxonica.com/documentation/index.html#!using-xquery/commandline");
System.err.println("Format: " + getClass().getName() + " options params");
System.err.println("Format: " + CommandLineOptions.getCommandName(this) + " options params");
CommandLineOptions options = new CommandLineOptions();
setPermittedOptions(options);
System.err.println("Options available:" + options.displayPermittedOptions());
......
......@@ -463,6 +463,7 @@ public class Transform {
value = options.getOptionValue("T");
if (value != null) {
if ("".equals(value)) {
traceListener = new net.sf.saxon.trace.XSLTTraceListener();
} else {
......@@ -471,6 +472,11 @@ public class Transform {
processor.setConfigurationProperty(Feature.TRACE_LISTENER, traceListener);
processor.setConfigurationProperty(Feature.LINE_NUMBERING, true);
String dest = options.getOptionValue("Tout");
if (dest != null) {
traceListener.setOutputDestination(new StandardLogger(new File(dest)));
}
value = options.getOptionValue("Tlevel");
if (value != null && traceListener instanceof AbstractTraceListener) {
switch (value) {
......@@ -488,6 +494,7 @@ public class Transform {
break;
}
}
}
value = options.getOptionValue("TB");
......@@ -619,9 +626,9 @@ public class Transform {
// config.checkLicensedFeature(Configuration.LicenseFeature.ENTERPRISE_XSLT, "schema-aware XSLT", -1);
// }
if (traceListener instanceof AbstractTraceListener && traceDestination != null) {
traceListener.setOutputDestination(traceDestination);
}
// if (traceListener instanceof AbstractTraceListener && traceDestination != null) {
// traceListener.setOutputDestination(traceDestination);
// }
value = options.getOptionValue("scmin");
if (value != null) {
......@@ -632,6 +639,8 @@ public class Transform {
CommandLineOptions.loadAdditionalSchemas(config, additionalSchemas);
}
options.applyStaticParams(compiler);
List<Source> sources = new ArrayList<>();
if (sourceFileName != null) {
boolean useSAXSource = sourceParserName != null || dtdValidation;
......@@ -683,13 +692,16 @@ public class Transform {
}
} else if (styleFileName.equals("-")) {
// take input from stdin
String sysID = new File(System.getProperty("user.dir")).toURI().toASCIIString();
if (styleParserName == null) {
styleSource = new StreamSource(System.in);
styleSource = new StreamSource(System.in, sysID);
} else if (Version.platform.isJava()) {
styleParser = config.getStyleParser();
styleSource = new SAXSource(styleParser, new InputSource(System.in));
final InputSource inputSource = new InputSource(System.in);
inputSource.setSystemId(sysID);
styleSource = new SAXSource(styleParser, inputSource);
} else {
styleSource = new StreamSource(System.in);
styleSource = new StreamSource(System.in, sysID);
}
} else {
PackageLibrary library = config.getDefaultXsltCompilerInfo().getPackageLibrary();
......@@ -725,7 +737,6 @@ public class Transform {
for (int j = 0; j < repeatComp; j++) {
// Repeat loop is to get reliable performance data
options.applyStaticParams(compiler);
///////////////////////////////////////
sheet = compiler.compile(styleSource);
///////////////////////////////////////
......@@ -1252,11 +1263,7 @@ public class Transform {
}
}
//if (r != repeat - 1) {
/*if (r < halfway) {
transformer.setTraceListener(null);
transformer.setTraceFunctionDestination(null);
}*/
options.applyFileParams(processor, transformer);
if (initialTemplate != null) {
QName initialTemplateName;
......@@ -1284,7 +1291,7 @@ public class Transform {
totalTime += endTime - startTime;
if (showTime) {
System.err.println("Execution time: " + CommandLineOptions.showExecutionTimeNano(endTime - startTime));
System.err.println("Memory used: " + String.format("%,d", Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
System.err.println("Memory used: " + CommandLineOptions.showMemoryUsed());
if (repeat > 1) {
System.err.println("-------------------------------");
Runtime.getRuntime().gc();
......@@ -1318,7 +1325,7 @@ public class Transform {
System.err.println(getConfiguration().getProductTitle());
}
System.err.println("Usage: see http://www.saxonica.com/documentation/index.html#!using-xsl/commandline");
System.err.println("Format: " + getClass().getName() + " options params");
System.err.println("Format: " + CommandLineOptions.getCommandName(this) + " options params");
CommandLineOptions options = new CommandLineOptions();
setPermittedOptions(options);
System.err.println("Options available:" + options.displayPermittedOptions());
......
......@@ -13,11 +13,10 @@ package net.sf.saxon;
public final class Version {
private static final int[] STRUCTURED_VERSION = {9, 9, 1, 1};
private static final String VERSION = "9.9.1.1";
//private static final String VERSION = "9.9.0.2-20181108";
private static final String BUILD = "012115"; //mmddhh
private static final String RELEASE_DATE = "2019-01-21";
private static final int[] STRUCTURED_VERSION = {9, 9, 1, 5};
private static final String VERSION = "9.9.1.5";
private static final String BUILD = "090514"; //mmddhh
private static final String RELEASE_DATE = "2019-09-05";
private static final String MAJOR_RELEASE_DATE = "2018-09-27";
private Version() {
......@@ -46,10 +45,10 @@ public final class Version {
}
/**
* Get the version number of the schema-aware version of the product
* Get the specific variant and version number of the product
*
* @param edition the Saxon edition code, e.g. "EE" or "JS"
* @return the version number of this version of Saxon, as a string
* @param edition the Saxon edition code, e.g. "EE", "HE", or "JS"
* @return the version number of this version of Saxon, as a string, for example "EE 9.9.0.1"
*/
public static String getProductVariantAndVersion(String edition) {
......@@ -59,7 +58,7 @@ public final class Version {
/**
* Get the user-visible version number of this version of the product
*
* @return the version number of this version of Saxon, as a string: for example "9.0.1"
* @return the version number of this version of Saxon, as a string: for example "9.9.0.1"
*/
public static String getProductVersion() {
......
<?xml version="1.0" encoding="UTF-8"?>
<scm:schema xmlns:scm="http://ns.saxonica.com/schema-component-model"
generatedAt="2019-01-17T15:41:29.343Z"
xsdVersion="1.1"
dmk="TGljZW5zb3I9U2F4b25pY2EKTGljZW5zZWU9TydOZWlsIERlbHByYXR0CkNvbXBhbnk9U2F4b25pY2EKRW1haWw9b25laWxAc2F4b25pY2EuY29tCkVkaXRpb249REUKU0FUPXllcwpTQVE9eWVzClNBVj15ZXMKSXNzdWVkPTIwMTgtMDctMDQKU2VyaWVzPU8KU2VyaWFsPU8wMDcwNjIKVXNlcj1QMDAwMQpFdmFsdWF0aW9uPW5vCkV4cGlyYXRpb249bmV2ZXIKVXBncmFkZURheXM9MzY2Ck1haW50ZW5hbmNlRGF5cz0zNjYKClNpZ25hdHVyZT0zMDJDMDIxNDA1RDJEREQ0NjBGQzhFODI0OTEyMkEzQzVBNzZENzRDRDdFMjk2OTcwMjE0NUM5MTQxNjAyNzYzRTlBNjU0Qjc3MkM3NTk3RDg5RTNCQkE5MTAzQg==">
generatedAt="2019-09-05T10:01:15.315+01:00"
xsdVersion="1.1">
<scm:simpleType id="C0"
name="finiteNumberType"
targetNamespace="http://www.w3.org/2005/xpath-functions"
......@@ -92,20 +91,20 @@
</scm:modelGroupParticle>
<scm:finiteStateMachine initialState="0">
<scm:state nr="0" final="true">
<scm:edge term="C14" to="1"/>
<scm:edge term="C17" to="1"/>
<scm:edge term="C15" to="1"/>
<scm:edge term="C18" to="1"/>
<scm:edge term="C19" to="1"/>
<scm:edge term="C17" to="1"/>
<scm:edge term="C16" to="1"/>
<scm:edge term="C14" to="1"/>
<scm:edge term="C15" to="1"/>
</scm:state>
<scm:state nr="1" final="true">
<scm:edge term="C14" to="1"/>
<scm:edge term="C17" to="1"/>
<scm:edge term="C15" to="1"/>
<scm:edge term="C18" to="1"/>
<scm:edge term="C19" to="1"/>
<scm:edge term="C17" to="1"/>
<scm:edge term="C16" to="1"/>
<scm:edge term="C14" to="1"/>
<scm:edge term="C15" to="1"/>
</scm:state>
</scm:finiteStateMachine>
</scm:complexType>
......@@ -151,20 +150,20 @@
</scm:modelGroupParticle>
<scm:finiteStateMachine initialState="0">
<scm:state nr="0" final="true">
<scm:edge term="C14" to="1"/>
<scm:edge term="C17" to="1"/>
<scm:edge term="C15" to="1"/>
<scm:edge term="C18" to="1"/>
<scm:edge term="C19" to="1"/>
<scm:edge term="C17" to="1"/>
<scm:edge term="C16" to="1"/>
<scm:edge term="C14" to="1"/>
<scm:edge term="C15" to="1"/>
</scm:state>
<scm:state nr="1" final="true">
<scm:edge term="C14" to="1"/>
<scm:edge term="C17" to="1"/>
<scm:edge term="C15" to="1"/>
<scm:edge term="C18" to="1"/>
<scm:edge term="C19" to="1"/>
<scm:edge term="C17" to="1"/>
<scm:edge term="C16" to="1"/>
<scm:edge term="C14" to="1"/>
<scm:edge term="C15" to="1"/>
</scm:state>
</scm:finiteStateMachine>
</scm:complexType>
......@@ -198,20 +197,20 @@
</scm:modelGroupParticle>
<scm:finiteStateMachine initialState="0">
<scm:state nr="0" final="true">
<scm:edge term="C26" to="1"/>
<scm:edge term="C27" to="1"/>
<scm:edge term="C26" to="1"/>
<scm:edge term="C31" to="1"/>
<scm:edge term="C29" to="1"/>
<scm:edge term="C30" to="1"/>
<scm:edge term="C28" to="1"/>
<scm:edge term="C29" to="1"/>
<scm:edge term="C31" to="1"/>
</scm:state>
<scm:state nr="1" final="true">
<scm:edge term="C26" to="1"/>
<scm:edge term="C27" to="1"/>
<scm:edge term="C26" to="1"/>
<scm:edge term="C31" to="1"/>
<scm:edge term="C29" to="1"/>
<scm:edge term="C30" to="1"/>
<scm:edge term="C28" to="1"/>
<scm:edge term="C29" to="1"/>
<scm:edge term="C31" to="1"/>
</scm:state>
</scm:finiteStateMachine>
</scm:complexType>
......@@ -241,20 +240,20 @@
</scm:modelGroupParticle>
<scm:finiteStateMachine initialState="0">
<scm:state nr="0" final="true">
<scm:edge term="C26" to="1"/>
<scm:edge term="C27" to="1"/>
<scm:edge term="C26" to="1"/>
<scm:edge term="C31" to="1"/>
<scm:edge term="C29" to="1"/>
<scm:edge term="C30" to="1"/>
<scm:edge term="C28" to="1"/>
<scm:edge term="C29" to="1"/>
<scm:edge term="C31" to="1"/>
</scm:state>
<scm:state nr="1" final="true">
<scm:edge term="C26" to="1"/>
<scm:edge term="C27" to="1"/>
<scm:edge term="C26" to="1"/>
<scm:edge term="C31" to="1"/>
<scm:edge term="C29" to="1"/>
<scm:edge term="C30" to="1"/>
<scm:edge term="C28" to="1"/>
<scm:edge term="C29" to="1"/>
<scm:edge term="C31" to="1"/>
</scm:state>
</scm:finiteStateMachine>
</scm:complexType>
......@@ -289,12 +288,12 @@
</scm:modelGroupParticle>
<scm:finiteStateMachine initialState="0">
<scm:state nr="0" final="true">
<scm:edge term="C36" to="1"/>
<scm:edge term="C35" to="1"/>
<scm:edge term="C36" to="1"/>
</scm:state>
<scm:state nr="1" final="true">
<scm:edge term="C36" to="1"/>
<scm:edge term="C35" to="1"/>
<scm:edge term="C36" to="1"/>
</scm:state>
</scm:finiteStateMachine>
</scm:complexType>
......@@ -555,4 +554,4 @@
defaultNamespace=""/>
</scm:unique>
</scm:schema>
<?Σ 706ac2ac?>
<?Σ b6ef09ea?>
......@@ -24,6 +24,7 @@ import net.sf.saxon.tree.wrapper.AbstractNodeWrapper;
import net.sf.saxon.tree.wrapper.SiblingCountingNode;
import net.sf.saxon.type.Type;
import net.sf.saxon.type.UType;
import org.jetbrains.annotations.NotNull;
import org.w3c.dom.*;
import java.util.ArrayList;
......@@ -757,10 +758,16 @@ public class DOMNodeWrapper extends AbstractNodeWrapper implements SiblingCounti
public DOMNodeWrapper getNextSibling() {
synchronized (docWrapper.docNode) {
Node currNode = node.getNextSibling();
Node currNode = node;
for (int i=0; i<span; i++) {
currNode = currNode.getNextSibling();
}
if (currNode != null) {
if (currNode.getNodeType() == Node.DOCUMENT_TYPE_NODE) {
short type = currNode.getNodeType();
if (type == Node.DOCUMENT_TYPE_NODE) {
currNode = currNode.getNextSibling();
} else if (type == Node.TEXT_NODE || type == Node.CDATA_SECTION_NODE) {
return spannedWrapper(currNode);
}
return makeWrapper(currNode, docWrapper);
}
......@@ -768,6 +775,23 @@ public class DOMNodeWrapper extends AbstractNodeWrapper implements SiblingCounti
}
}
@NotNull
private DOMNodeWrapper spannedWrapper(Node currNode) {
Node currText = currNode;
int thisSpan = 1;
while (true) {
currText = currText.getNextSibling();
if (currText != null && (currText.getNodeType() == Node.TEXT_NODE || currText.getNodeType() == Node.CDATA_SECTION_NODE)) {
thisSpan++;
} else {
break;
}
}
DOMNodeWrapper spannedText = makeWrapper(currNode, docWrapper);
spannedText.span = thisSpan;
return spannedText;
}
public DOMNodeWrapper getFirstChild() {
synchronized (docWrapper.docNode) {
......@@ -776,6 +800,9 @@ public class DOMNodeWrapper extends AbstractNodeWrapper implements SiblingCounti
if (currNode.getNodeType() == Node.DOCUMENT_TYPE_NODE) {
currNode = currNode.getNextSibling();
}
if (currNode.getNodeType() == Node.TEXT_NODE || currNode.getNodeType() == Node.CDATA_SECTION_NODE) {
return spannedWrapper(currNode);
}
return makeWrapper(currNode, docWrapper);
}
return null;
......@@ -786,8 +813,23 @@ public class DOMNodeWrapper extends AbstractNodeWrapper implements SiblingCounti
synchronized (docWrapper.docNode) {
Node currNode = node.getPreviousSibling();
if (currNode != null) {
if (currNode.getNodeType() == Node.DOCUMENT_TYPE_NODE) {
short type = currNode.getNodeType();
if (type == Node.DOCUMENT_TYPE_NODE) {
return null;
} else if (type == Node.TEXT_NODE || type == Node.CDATA_SECTION_NODE) {
int span = 1;
while (true) {
Node prev = currNode.getPreviousSibling();
if (prev != null && (prev.getNodeType() == Node.TEXT_NODE || prev.getNodeType() == Node.CDATA_SECTION_NODE)) {
span++;
currNode = prev;
} else {
break;
}
}
DOMNodeWrapper wrapper = makeWrapper(currNode, docWrapper);
wrapper.span = span;
return wrapper;
}
return makeWrapper(currNode, docWrapper);
}
......
......@@ -196,6 +196,7 @@ public abstract class Sender {
newSource instanceof AugmentedSource ||
newSource instanceof EventSource) {
send(newSource, next, options);
return;
}
// See if there is a registered external object model that knows about this kind of source
......
......@@ -90,6 +90,7 @@ public abstract class SequenceNormalizer extends ProxyReceiver {
previousAtomic = false;
} catch (XPathException e) {
failed = true;
e.maybeSetLocation(location);
throw e;
}
}
......
......@@ -160,15 +160,19 @@ public class StartTagBuffer extends ProxyReceiver implements NamespaceResolver {
}
// avoid duplicates
boolean duplicate = false;
for (int n = 0; n < countStack[depth - 1]; n++) {
if (namespaces[namespacesSize - 1 - n].equals(namespaceBindings)) {
return;
if (namespaces[namespacesSize - 1 - n].equals(ns)) {
duplicate = true;
break;
}
}
if (!duplicate) {
addToStack(ns);
countStack[depth - 1]++;
}
}
}
/**
* Notify an attribute. Attributes are notified after the startElement event, and before any
......
......@@ -12,6 +12,7 @@ import net.sf.saxon.expr.instruct.Block;
import net.sf.saxon.expr.instruct.Choose;
import net.sf.saxon.expr.instruct.ValueOf;
import net.sf.saxon.expr.parser.*;
import net.sf.saxon.lib.NamespaceConstant;
import net.sf.saxon.ma.arrays.ArrayItemType;
import net.sf.saxon.ma.map.MapType;
import net.sf.saxon.om.*;
......@@ -349,10 +350,10 @@ public final class Atomizer extends UnaryExpression {
SequenceIterator base = getBaseExpression().iterate(context);
return getAtomizingIterator(base, untyped && operandItemType instanceof NodeTest);
} catch (XPathException e) {
if (roleDiagnostic == null) {
if (roleDiagnostic == null || !e.getErrorCodeQName().hasURI(NamespaceConstant.ERR)) {
throw e;
} else {
String message = e.getMessage() + ". Failed while atomizing the " + roleDiagnostic.getMessage();
String message = expandMessage(e.getMessage());
XPathException e2 = new XPathException(message, e.getErrorCodeLocalPart(), e.getLocator());
e2.setXPathContext(context);
e2.maybeSetLocation(getLocation());
......
......@@ -485,6 +485,7 @@ public final class AxisExpression extends Expression {
" does not allow a child element named " + getDiagnosticName(childElement, env);
IntHashSet permitted = new IntHashSet();
((ComplexType) contentType).gatherAllPermittedChildren(permitted, false);
if (!permitted.contains(-1)) {
IntIterator kids = permitted.iterator();
while (kids.hasNext()) {
int kid = kids.next();
......@@ -498,6 +499,7 @@ public final class AxisExpression extends Expression {
}
visitor.issueWarning(message, getLocation());
}
}
return Literal.makeEmptySequence();
} else {
itemType = new CombinedNodeTest(
......
......@@ -8,10 +8,16 @@
package net.sf.saxon.expr;
import net.sf.saxon.expr.instruct.Actor;
import net.sf.saxon.expr.instruct.AttributeSet;
import net.sf.saxon.expr.instruct.GlobalVariable;
import net.sf.saxon.expr.instruct.NamedTemplate;
import net.sf.saxon.om.Function;
import net.sf.saxon.om.StandardNames;
import net.sf.saxon.style.StylesheetPackage;
import net.sf.saxon.trace.ExpressionPresenter;
import net.sf.saxon.trans.Mode;
import net.sf.saxon.trans.Visibility;
import net.sf.saxon.trans.VisibilityProvenance;
import net.sf.saxon.trans.XPathException;
import net.sf.saxon.tree.util.FastStringBuffer;
......@@ -31,7 +37,7 @@ public class Component {
private List<ComponentBinding> bindings = new ArrayList<ComponentBinding>();
private StylesheetPackage containingPackage;
private StylesheetPackage declaringPackage;
private boolean hasExplicitVisibility;
private VisibilityProvenance provenance;
private Component baseComponent;
......@@ -39,15 +45,15 @@ public class Component {
/**
* Create a component
*
* @param actor the compiled code that implements the component, for example a Template or Function
* @param visibility the visibility of the component
* @param provenance indicates where the visibility property came from
* @param containingPackage the package to which this component belongs
* @param declaringPackage the package in which the original declaration of the component appears
*/
public static Component makeComponent(
Actor actor, Visibility visibility, StylesheetPackage containingPackage, StylesheetPackage declaringPackage) {
Actor actor, Visibility visibility, VisibilityProvenance provenance, StylesheetPackage containingPackage, StylesheetPackage declaringPackage) {
Component c;
if (actor instanceof Mode) {
c = new M();
......@@ -56,7 +62,7 @@ public class Component {
}
c.actor = actor;
c.visibility = visibility;
c.hasExplicitVisibility = visibility != null;
c.provenance = provenance;
c.containingPackage = containingPackage;
c.declaringPackage = declaringPackage;
return c;
......@@ -89,12 +95,12 @@ public class Component {
/**
* Set the visibility of the component, and say whether it is explicit or defaulted
* @param visibility the visibility of the component
* @param explicit set to true if the visibility is an explicit attribute on the component declaration
* @param provenance indicates where the visibility property came from
*/
public void setVisibility(Visibility visibility, boolean explicit) {
public void setVisibility(Visibility visibility, VisibilityProvenance provenance) {
this.visibility = visibility;
this.hasExplicitVisibility = explicit;
this.provenance = provenance;
}
/**
......@@ -110,13 +116,14 @@ public class Component {
}
/**
* Ask whether the visibility of the component is due to an explicit visibility attribute on the component
* Determine whether the visibility of the component is due to an explicit visibility attribute
* on the component declaration, or whether it was inferred, or came from an xsl:expose or xsl:accept
* declaration
* @return true if the visibility was explicitly declared
* @return the provenance of the visibility property
*/
public boolean isVisibilityExplicit() {
return hasExplicitVisibility;
public VisibilityProvenance getVisibilityProvenance() {
return provenance;
}
/**
......@@ -141,6 +148,22 @@ public class Component {
return actor;
}
public int getComponentKind() {
if (actor instanceof NamedTemplate) {
return StandardNames.XSL_TEMPLATE;
} else if (actor instanceof GlobalVariable) {
return StandardNames.XSL_VARIABLE;
} else if (actor instanceof Function) {
return StandardNames.XSL_FUNCTION;
} else if (actor instanceof AttributeSet) {
return StandardNames.XSL_ATTRIBUTE_SET;
} else if (actor instanceof Mode) {
return StandardNames.XSL_MODE;
} else {
return -1;
}
}
/**
* Get the declaring package of this component
*
......@@ -193,7 +216,7 @@ public class Component {
out.startElement("co");
int id = obtainComponentId(this, componentIdMap);
out.emitAttribute("id", ""+id);
if (getVisibility() != null && getVisibility() != Visibility.PRIVATE) {
if (getVisibilityProvenance() != VisibilityProvenance.DEFAULTED) {
out.emitAttribute("vis", getVisibility().toString());
}
String refs = listComponentReferences(componentIdMap);
......
......@@ -8,12 +8,12 @@
package net.sf.saxon.expr;
import net.sf.saxon.expr.parser.ExpressionTool;
import net.sf.saxon.om.*;
import net.sf.saxon.om.FocusIterator;
import net.sf.saxon.om.Item;
import net.sf.saxon.om.NodeInfo;
import net.sf.saxon.om.SequenceIterator;
import net.sf.saxon.trans.XPathException;
import net.sf.saxon.value.BooleanValue;
import net.sf.saxon.value.Int64Value;
import net.sf.saxon.value.NumericValue;
import net.sf.saxon.value.StringValue;
import net.sf.saxon.value.*;
/**
* A FilterIterator filters an input sequence using a filter expression. Note that a FilterIterator
......@@ -109,27 +109,33 @@ public class FilterIterator<T extends Item<?>> implements SequenceIterator<T> {
} else {
if (first instanceof BooleanValue) {
if (iterator.next() != null) {
ExpressionTool.ebvError("sequence of two or more items starting with a boolean", filter);
ExpressionTool.ebvError("a sequence of two or more items starting with a boolean", filter);
}
return ((BooleanValue) first).getBooleanValue();
} else if (first instanceof StringValue) {
if (iterator.next() != null) {
ExpressionTool.ebvError("sequence of two or more items starting with a string", filter);
ExpressionTool.ebvError("a sequence of two or more items starting with a string", filter);
}
return first.getStringValueCS().length() != 0;
} else if (first instanceof Int64Value) {
if (iterator.next() != null) {
ExpressionTool.ebvError("sequence of two or more items starting with a numeric value", filter);
ExpressionTool.ebvError("a sequence of two or more items starting with a numeric value", filter);
}
return ((Int64Value) first).longValue() == position;
} else if (first instanceof NumericValue) {
if (iterator.next() != null) {
ExpressionTool.ebvError("sequence of two or more items starting with a numeric value", filter);
ExpressionTool.ebvError("a sequence of two or more items starting with a numeric value", filter);
}
return ((NumericValue) first).compareTo(position) == 0;
} else if (first instanceof AtomicValue) {
ExpressionTool.ebvError("a sequence starting with an atomic value of type "
+ ((AtomicValue) first).getPrimitiveType().getDisplayName()
+ " (" + first.toShortString() + ")",
filter);
return false;
} else {
ExpressionTool.ebvError("sequence starting with an atomic value other than a boolean, number, or string", filter);
ExpressionTool.ebvError("a sequence starting with " + first.getGenre().getDescription() + " (" + first.toShortString() + ")", filter);
return false;
}
}
......
......@@ -12,7 +12,6 @@ import net.sf.saxon.expr.parser.ExpressionTool;
import net.sf.saxon.expr.parser.ExpressionVisitor;
import net.sf.saxon.expr.parser.RebindingMap;
import net.sf.saxon.expr.sort.DocumentSorter;
import net.sf.saxon.om.Item;
import net.sf.saxon.om.SequenceIterator;
import net.sf.saxon.pattern.AnyNodeTest;
import net.sf.saxon.trans.XPathException;
......@@ -55,15 +54,15 @@ public class HomogeneityChecker extends UnaryExpression {
int rel = th.relationship(type, AnyNodeTest.getInstance());
if (rel == TypeHierarchy.DISJOINT) {
// expression cannot return nodes, so this checker is redundant
if (getBaseExpression() instanceof SlashExpression && ((SlashExpression) getBaseExpression()).getLeadingSteps() instanceof SlashExpression &&
(((SlashExpression) getBaseExpression()).getLeadingSteps().getSpecialProperties() & StaticProperty.ORDERED_NODESET) == 0) {
DocumentSorter ds = new DocumentSorter(((SlashExpression) getBaseExpression()).getLeadingSteps());
SlashExpression se = new SlashExpression(ds, ((SlashExpression) getBaseExpression()).getLastStep());
ExpressionTool.copyLocationInfo(this, se);
return se;
} else {
// if (getBaseExpression() instanceof SlashExpression && ((SlashExpression) getBaseExpression()).getLeadingSteps() instanceof SlashExpression &&
// (((SlashExpression) getBaseExpression()).getLeadingSteps().getSpecialProperties() & StaticProperty.ORDERED_NODESET) == 0) {
// DocumentSorter ds = new DocumentSorter(((SlashExpression) getBaseExpression()).getLeadingSteps());
// SlashExpression se = new SlashExpression(ds, ((SlashExpression) getBaseExpression()).getLastStep());
// ExpressionTool.copyLocationInfo(this, se);
// return se;
// } else {
return getBaseExpression();
}
// }
} else if (rel == TypeHierarchy.SAME_TYPE || rel == TypeHierarchy.SUBSUMED_BY) {
// expression always returns nodes, so replace this expression with a DocumentSorter
Expression savedBase = getBaseExpression();
......