Package org.exist.xslt.expression

Examples of org.exist.xslt.expression.XSLPathExpr


  public static XSLPathExpr parse(XQueryContext context, String str) throws XPathException {
    if (!(str != null && str.startsWith("{") && str.endsWith("}"))) {
      return null;
    }
   
    XSLPathExpr expr = new XSLPathExpr((XSLContext) context);
    parse(context, str.substring(1, str.length() - 1), expr);
   
    return expr;
  }
View Full Code Here


      throw new XPathException("InvocationTargetException",e);
    }
  }

  public Expression compile(ContextAtExist context) throws XPathException {
    XSLPathExpr exec;
   
    if ((!isXSLElement(this)) && (isParentNode())) { //UNDERSTAND: put to XSLStylesheet?
      expr = new XSLStylesheet((XSLContext) context, true);
     
      SimpleConstructor constructer = getNodeConstructor(context, this, expr);
      if (constructer != null) {
        expr.add(constructer);

        compileNode(context, expr, this);
      }
     
      exec = expr;
    } else {
      preprocess(context);

      exec = getExpressionInstance(context);

      compileNode(context, exec, this);
    }
   
    exec.validate();//UNDERSTAND: at compile time??? analyze ???
   
    return exec;
  }
View Full Code Here

  private SimpleConstructor getNodeConstructor(ContextAtExist context, NodeAtExist node, XSLPathExpr content) throws XPathException {
    SimpleConstructor constructer = null;
    if (node.getNodeType() == Node.ELEMENT_NODE) {
      Element element = new Element((XSLContext) context, node.getNodeName());
      content.add(element);
      XSLPathExpr content_sub = new XSLPathExpr((XSLContext) context);
      element.setContent(content_sub);
   
      NamedNodeMap attrs = node.getAttributes();
      for (int index = 0; index < attrs.getLength(); index++) {
        Node attr = attrs.item(index);
        if (("xmlns:".equals(attr.getNodeName())) && ("".equals(attr.getLocalName()))) { //getNodeValue
          continue;//UNDERSTAND: is it required, to have empty namespace
        }
            if (isParentNode()) {
              if ("xmlns:xsl".equals(attr.getNodeName())) {
                continue;
              } else if (attr.getNodeName().startsWith("xsl")) {
                continue;
              }
            }
        element.prepareAttribute(context, (Attr) attr);
      }
   
      compileNode(context, content_sub, node);
    } else if (node.getNodeType() == Node.COMMENT_NODE) {
//UNDERSTAND:      constructer = new CommentConstructor((XQueryContext) context, node.getNodeName());
    } else if (node.getNodeType() == Node.TEXT_NODE) {
      if (content instanceof XSLPathExpr) {
        XSLPathExpr xslExpr = (XSLPathExpr) content;
        xslExpr.addText(node.getNodeValue());
      } else
        constructer = new Text((XSLContext) context, node.getNodeValue());
    } else if (node.getNodeType() == Node.CDATA_SECTION_NODE) {
//UNDERSTAND:      constructer = new CDATAConstructor((XQueryContext) context, node.getNodeName());
    } else if (node.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
View Full Code Here

        for (Iterator<Object> i = contents.iterator(); i.hasNext();) {
          Object obj = i.next();
          if (obj instanceof String) {
        String value = (String) obj;
        if (value.startsWith("{") && value.startsWith("}")) {
          XSLPathExpr expr = new XSLPathExpr((XSLContext) getContext());
            Pattern.parse(contextInfo.getContext(),
                value.substring(1, value.length() - 1),
                expr);
            newContents.add(expr);
            continue;
View Full Code Here

TOP

Related Classes of org.exist.xslt.expression.XSLPathExpr

Copyright © 2018 www.massapicom. 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.