Permalink
Browse files

Fix issue #120 by making sure the default parameter input port is use…

…d by default
  • Loading branch information...
ndw committed Sep 22, 2013
1 parent 63e9acb commit c56d5c71a5e0c5d61ed979e415810817b78bf42a
Showing with 19 additions and 3 deletions.
  1. +7 −1 src/com/xmlcalabash/runtime/XPipelineCall.java
  2. +12 −2 src/com/xmlcalabash/runtime/XStep.java
@@ -69,7 +69,13 @@ public void run() throws SaxonApiException {
for (QName name : step.getParameters()) {
Parameter param = step.getParameter(name);
RuntimeValue value = computeValue(param);
newstep.setParameter(name, value);
String port = param.getPort();
if (port == null) {
newstep.setParameter(name, value);
} else {
newstep.setParameter(port, name, value);
}
}
for (String port : inputs.keySet()) {
@@ -111,17 +111,27 @@ public void setParameter(QName name, RuntimeValue value) {
Set<String> ports = getParameterPorts();
int pportCount = 0;
String pport = null;
String ppport = null;
for (String port : ports) {
pport = port;
pportCount++;
Input pin = getStep().getInput(port);
if (pin.getPrimary()) {
ppport = port;
}
}
if (pportCount == 0) {
throw new XProcException(step.getNode(), "Attempt to set parameter but there's no parameter port.");
}
if (pportCount > 1) {
throw new XProcException(step.getNode(), "Attempt to set parameter w/o specifying a port (and there's more than one)");
if (ppport != null) {
pport = ppport;
} else {
if (pportCount > 1) {
throw new XProcException(step.getNode(), "Attempt to set parameter w/o specifying a port (and there's more than one)");
}
}
setParameter(pport, name, value);

0 comments on commit c56d5c7

Please sign in to comment.