Examples of RuntimeValue


Examples of com.xmlcalabash.model.RuntimeValue

    private XdmNode makeReplacements(XdmNode doc, List<XPathReplacement> replacements) {
        for (XPathReplacement xpathRepl : replacements) {
          matcher = new ProcessMatch(runtime, xpathRepl);
          xpathRepl.setMatcher(matcher);
         
            matcher.match(doc, new RuntimeValue(xpathRepl.getXPath()));
            doc = matcher.getResult();
        }
       
        return doc;
  }
View Full Code Here

Examples of com.xmlcalabash.model.RuntimeValue

    XdmNode updatedDoc = processInlineImages (source.read());
    result.write(updatedDoc);
  }

  private URI getTargetDirectoryURI() {
    RuntimeValue target = getOption(_target);
    URI uri = null;

    if (target != null) {
      uri = target.getBaseURI().resolve(FilenameUtils.normalizeNoEndSeparator(target.getString()).replace(File.separatorChar, '/'))
    }
   
    return uri;
  }
View Full Code Here

Examples of com.xmlcalabash.model.RuntimeValue

   
    return uri;
  }

  private URI getTargetHtmlContentDirectoryURI() {
    RuntimeValue target = getOption(_targetHtmlContentDir);
    URI uri = null;
    if (target != null) {
      uri = target.getBaseURI().resolve(target.getString().replace(File.separatorChar, '/'));
    }
    return uri;
  }
View Full Code Here

Examples of com.xmlcalabash.model.RuntimeValue

                    getOutputType());

    matcher = new ProcessMatch(runtime, copyTransform);
    copyTransform.setMatcher(matcher);

    matcher.match(doc, new RuntimeValue(fileRefsXpath));
    doc = matcher.getResult();
   
    if (copyTransform.hasErrors() && isFailOnErrorFlagSet()) {
      throw new XProcException("One or more images refered in the docbook were not found. Please see log for details.");
    }
View Full Code Here

Examples of com.xmlcalabash.model.RuntimeValue

      this.pipeline = pipeline;
      this.legacySourceOutput = legacySourceOutput;
   }
  
   protected <T> RuntimeValue getRuntimeValue(PipelineInput<T> input) {
      RuntimeValue runtimeValue;
      T source = input.getSource();
     
      if (source instanceof InputStream) {
         runtimeValue =  new RuntimeValue(getUriResolver().addStream((InputStream)source));
      } else if (source instanceof String) {
         runtimeValue =  new RuntimeValue(source.toString());
      } else {
         // TODO: handle other types?
         throw new IllegalArgumentException("Illegal input type: " + source.getClass().getName());
      }
     
View Full Code Here

Examples of com.xmlcalabash.model.RuntimeValue

      return runtimeValue;
   }
  
   @Override
   protected <T> void addParameter(PipelineInput<T> input) {
      RuntimeValue runtimeParam = getRuntimeValue(input);
     
      if (pipeline.getInputs().contains("parameters")) {
         pipeline.setParameter("parameters", new QName("", input.getName()), runtimeParam);
      } else {
         pipeline.setParameter(new QName("", input.getName()), runtimeParam);
View Full Code Here

Examples of com.xmlcalabash.model.RuntimeValue

            for (QName optionName : options) {
               getLogger().fine("Setting option: "+optionName);
               String value = getOptionValue(optionName);
               if (value!=null) {
                  getLogger().fine("Option: "+optionName+"="+value);
                  pipeline.passOption(optionName, new RuntimeValue(value));
               }
            }
         }
         final String outputPort = xproc.getPipeline().getOutputs().iterator().next();
         return new OutputRepresentation(MediaType.APPLICATION_XML) {
View Full Code Here

Examples of com.xmlcalabash.model.RuntimeValue


    public void run() throws SaxonApiException {
        super.run();

        RuntimeValue match = getOption(_match);
        replace = getOption(_replace);
        for (String prefix : replace.getNamespaceBindings().keySet()) {
            rns.put(prefix, replace.getNamespaceBindings().get(prefix));
        }
View Full Code Here

Examples of com.xmlcalabash.model.RuntimeValue

        String codeNameStr = null;
        String cpfx = null;
        String cns = null;
       
        RuntimeValue codeNameValue = getOption(_code);
        if (codeNameValue != null) {
            codeNameStr = codeNameValue.getString();
            cpfx = getOption(_code_prefix, (String) null);
            cns = getOption(_code_namespace, (String) null);
        }

        if (cpfx == null && cns != null) {
            cpfx = "ERR";
        }

        if (cpfx != null && cns == null) {
            throw XProcException.dynamicError(34, "You can't specify a prefix without a namespace");
        }

        if (cns != null && codeNameStr.contains(":")) {
            throw XProcException.dynamicError(34, "You can't specify a namespace if the code name contains a colon");
        }

        QName errorCode = null;
        if (codeNameStr != null) {
            if (codeNameStr.contains(":")) {
                errorCode = new QName(codeNameStr, codeNameValue.getNode());
            } else {
                errorCode = new QName(cpfx == null ? "" : cpfx, cns, codeNameStr);
            }
        }
View Full Code Here

Examples of com.xmlcalabash.model.RuntimeValue

        QName initialMode = null;
        QName templateName = null;
        String outputBaseURI = null;

        RuntimeValue opt = getOption(_initial_mode);
        if (opt != null) {
            initialMode = opt.getQName();
        }

        opt = getOption(_template_name);
        if (opt != null) {
            templateName = opt.getQName();
        }

        opt = getOption(_output_base_uri);
        if (opt != null) {
            outputBaseURI = opt.getString();
        }

        Processor processor = runtime.getProcessor();
        Configuration config = processor.getUnderlyingConfiguration();

        runtime.getConfigurer().getSaxonConfigurer().configXSLT(config);

        OutputURIResolver uriResolver = config.getOutputURIResolver();
        CollectionURIResolver collectionResolver = config.getCollectionURIResolver();
        UnparsedTextURIResolver unparsedTextURIResolver = runtime.getResolver();

        config.setOutputURIResolver(new OutputResolver());
        config.setCollectionURIResolver(new CollectionResolver(runtime, defaultCollection, collectionResolver));

        XdmDestination result = null;
        try {
            XsltCompiler compiler = runtime.getProcessor().newXsltCompiler();
            compiler.setSchemaAware(processor.isSchemaAware());
            XsltExecutable exec = compiler.compile(stylesheet.asSource());
            XsltTransformer transformer = exec.load();

            for (QName name : params.keySet()) {
                RuntimeValue v = params.get(name);
                if (runtime.getAllowGeneralExpressions()) {
                    transformer.setParameter(name, v.getValue());
                } else {
                    transformer.setParameter(name, new XdmAtomicValue(v.getString()));
                }
            }

            if (document != null) {
                transformer.setInitialContextNode(document);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.