Exemplo n.º 1
0
 @Override
 void parse(XdmNode node) {
   String hr = XProcUtil.getAttrString(node, "href");
   URI base = node.getBaseURI();
   if (base != null) href = base.resolve(hr).toString();
   else href = hr;
 }
Exemplo n.º 2
0
  public boolean processStartElement(XdmNode node) {
    // Use a TreeWriter to make the matching node into a proper document
    TreeWriter treeWriter = new TreeWriter(runtime);
    treeWriter.startDocument(node.getBaseURI());
    treeWriter.addSubtree(node);
    treeWriter.endDocument();

    current.resetWriter();
    current.write(treeWriter.getResult());

    finest(step.getNode(), "Viewport copy matching node to " + current);

    sequencePosition++;
    runtime.getXProcData().setIterationPosition(sequencePosition);

    // Calculate all the variables
    inScopeOptions = parent.getInScopeOptions();
    for (Variable var : step.getVariables()) {
      RuntimeValue value = computeValue(var);

      if ("p3".equals(var.getName().getLocalName())) {
        System.err.println("DEBUG ME1: " + value.getString());
      }

      inScopeOptions.put(var.getName(), value);
    }

    try {
      for (XStep step : subpipeline) {
        step.reset();
        step.run();
      }
    } catch (SaxonApiException sae) {
      throw new XProcException(sae);
    }

    try {
      int count = 0;
      for (String port : inputs.keySet()) {
        if (port.startsWith("|")) {
          for (ReadablePipe reader : inputs.get(port)) {
            while (reader.moreDocuments()) {
              count++;

              if (count > 1) {
                XOutput output = getOutput(port.substring(1));
                if (!output.getSequence()) {
                  throw XProcException.dynamicError(7);
                }
              }

              XdmNode doc = reader.read();
              matcher.addSubtree(doc);
            }
            reader.resetReader();
          }
        }
      }
    } catch (SaxonApiException sae) {
      throw new XProcException(sae);
    }

    return false;
  }