private void checkStrictStreamability(Expression body) throws XPathException { getConfiguration().checkStrictStreamability(this, body); }
private void checkStrictStreamability(Expression body) throws XPathException { getConfiguration().checkStrictStreamability(this, body); }
private void createSkeletonTemplate(Compilation compilation, ComponentDeclaration decl) throws XPathException { StructuredQName[] modes = modeNames; if (isOmniMode()) { List<StructuredQName> all = new ArrayList<>(); all.add(Mode.UNNAMED_MODE_NAME); RuleManager mgr = getCompilation().getPrincipalStylesheetModule().getRuleManager(); for (Mode m : mgr.getAllNamedModes()) { all.add(m.getModeName()); } modes = all.toArray(new StructuredQName[0]); } for (StructuredQName modeName : modes) { TemplateRule templateRule = compiledTemplateRules.get(modeName); if (templateRule == null) { templateRule = getConfiguration().makeTemplateRule(); } templateRule.prepareInitializer(compilation, decl, modeName); compiledTemplateRules.put(modeName, templateRule); RetainedStaticContext rsc = makeRetainedStaticContext(); templateRule.setPackageData(rsc.getPackageData()); setCompiledTemplateRuleProperties(templateRule, null); } }
private void createSkeletonTemplate(Compilation compilation, ComponentDeclaration decl) throws XPathException { StructuredQName[] modes = modeNames; if (isOmniMode()) { List<StructuredQName> all = new ArrayList<>(); all.add(Mode.UNNAMED_MODE_NAME); RuleManager mgr = getCompilation().getPrincipalStylesheetModule().getRuleManager(); for (Mode m : mgr.getAllNamedModes()) { all.add(m.getModeName()); } modes = all.toArray(new StructuredQName[0]); } for (StructuredQName modeName : modes) { TemplateRule templateRule = compiledTemplateRules.get(modeName); if (templateRule == null) { templateRule = getConfiguration().makeTemplateRule(); } templateRule.prepareInitializer(compilation, decl, modeName); compiledTemplateRules.put(modeName, templateRule); RetainedStaticContext rsc = makeRetainedStaticContext(); templateRule.setPackageData(rsc.getPackageData()); setCompiledTemplateRuleProperties(templateRule, null); } }
ICompilerService compilerService = getConfiguration().makeCompilerService(Configuration.XSLT); if (getTemplateName() != null) { try {
public ItemType getContextItemTypeForTemplateRule() throws XPathException { Configuration config = getConfiguration(); ItemType contextItemType = match.getItemType(); if (contextItemType.equals(ErrorType.getInstance())) { // if the match pattern can't match anything, we produce a warning, not a hard error contextItemType = AnyItemType.getInstance(); } if (requiredContextItemType != AnyItemType.getInstance()) { int rel = config.getTypeHierarchy().relationship(contextItemType, requiredContextItemType); switch (rel) { case TypeHierarchy.DISJOINT: XPathException e = new XPathException("The declared context item type is inconsistent with the match pattern", "XPTY0004", this); e.setIsTypeError(true); throw e; case TypeHierarchy.SUBSUMED_BY: case TypeHierarchy.OVERLAPS: case TypeHierarchy.SAME_TYPE: // no action break; case TypeHierarchy.SUBSUMES: contextItemType = requiredContextItemType; break; } } return contextItemType; }
ICompilerService compilerService = getConfiguration().makeCompilerService(Configuration.XSLT); if (getTemplateName() != null) { try {
public ItemType getContextItemTypeForTemplateRule() throws XPathException { Configuration config = getConfiguration(); ItemType contextItemType = match.getItemType(); if (contextItemType.equals(ErrorType.getInstance())) { // if the match pattern can't match anything, we produce a warning, not a hard error contextItemType = AnyItemType.getInstance(); } if (requiredContextItemType != AnyItemType.getInstance()) { int rel = config.getTypeHierarchy().relationship(contextItemType, requiredContextItemType); switch (rel) { case TypeHierarchy.DISJOINT: XPathException e = new XPathException("The declared context item type is inconsistent with the match pattern", "XPTY0004", this); e.setIsTypeError(true); throw e; case TypeHierarchy.SUBSUMED_BY: case TypeHierarchy.OVERLAPS: case TypeHierarchy.SAME_TYPE: // no action break; case TypeHierarchy.SUBSUMES: contextItemType = requiredContextItemType; break; } } return contextItemType; }
public void validate() throws XPathException { stackFrameMap = getConfiguration().makeSlotManager(); checkTopLevel(null); // the check for duplicates is now done in the buildIndexes() method of XSLStylesheet if (match != null) { match = typeCheck("match", match); if (match.getNodeTest() instanceof EmptySequenceTest) { try { getConfiguration().getErrorListener().warning( new TransformerException("Match pattern cannot match any nodes", this)); } catch (TransformerException e) { compileError(XPathException.makeXPathException(e)); } } } // See if there are any required parameters. AxisIterator kids = iterateAxis(Axis.CHILD); while(true) { NodeInfo param = (NodeInfo)kids.next(); if (param == null) { break; } if (param instanceof XSLParam && ((XSLParam)param).isRequiredParam()) { hasRequiredParams = true; break; } } }
public void compileTemplateRule(Compilation compilation, Expression body, ComponentDeclaration decl) { Configuration config = getConfiguration(); if (getTemplateName() != null) { body = body.copy(new RebindingMap()); } ItemType contextItemType; ContextItemStaticInfo cisi; // the template can't be called by name, so the context item must match the match pattern contextItemType = match.getItemType(); if (contextItemType.equals(ErrorType.getInstance())) { // if the match pattern can't match anything, we produce a warning, not a hard error contextItemType = AnyItemType.getInstance(); } cisi = config.makeContextItemStaticInfo(contextItemType, false); body = refineTemplateBody(body, cisi); boolean needToCopy = false; for (TemplateRule rule : compiledTemplateRules.values()) { if (needToCopy) { body = body.copy(new RebindingMap()); } setCompiledTemplateRuleProperties(rule, body); needToCopy = true; rule.updateSlaveCopies(); } // following code needed only for diagnostics //body.verifyParentPointers(); }
public void validate() throws XPathException { stackFrameMap = getConfiguration().makeSlotManager(); checkTopLevel(null); // the check for duplicates is now done in the buildIndexes() method of XSLStylesheet if (match != null) { match = typeCheck("match", match); if (match.getNodeTest() instanceof EmptySequenceTest) { try { getConfiguration().getErrorListener().warning( new TransformerException("Match pattern cannot match any nodes", this)); } catch (TransformerException e) { compileError(XPathException.makeXPathException(e)); } } } markTailCalls(); // See if there are any required parameters AxisIterator declaredParams = iterateAxis(Axis.CHILD); while(true) { NodeInfo param = (NodeInfo)declaredParams.next(); if (param == null) { break; } if (param instanceof XSLParam && ((XSLParam)param).isRequiredParam()) { hasRequiredParams = true; break; } } }
public void validate() throws XPathException { stackFrameMap = getConfiguration().makeSlotManager(); checkTopLevel(null); // the check for duplicates is now done in the buildIndexes() method of XSLStylesheet if (match != null) { match = typeCheck("match", match); if (match.getNodeTest() instanceof EmptySequenceTest) { try { getConfiguration().getErrorListener().warning( new TransformerException("Match pattern cannot match any nodes", this)); } catch (TransformerException e) { compileError(XPathException.makeXPathException(e)); } } } markTailCalls(); // See if there are any required parameters AxisIterator declaredParams = iterateAxis(Axis.CHILD); while(true) { NodeInfo param = (NodeInfo)declaredParams.next(); if (param == null) { break; } if (param instanceof XSLParam && ((XSLParam)param).isRequiredParam()) { hasRequiredParams = true; break; } } }
public void compileTemplateRule(Compilation compilation, Expression body, ComponentDeclaration decl) { Configuration config = getConfiguration(); if (getTemplateName() != null) { body = body.copy(new RebindingMap()); } ItemType contextItemType; ContextItemStaticInfo cisi; // the template can't be called by name, so the context item must match the match pattern contextItemType = match.getItemType(); if (contextItemType.equals(ErrorType.getInstance())) { // if the match pattern can't match anything, we produce a warning, not a hard error contextItemType = AnyItemType.getInstance(); } cisi = config.makeContextItemStaticInfo(contextItemType, false); body = refineTemplateBody(body, cisi); boolean needToCopy = false; for (TemplateRule rule : compiledTemplateRules.values()) { if (needToCopy) { body = body.copy(new RebindingMap()); } setCompiledTemplateRuleProperties(rule, body); needToCopy = true; rule.updateSlaveCopies(); } // following code needed only for diagnostics //body.verifyParentPointers(); }
Configuration config = getConfiguration(); if (compiledNamedTemplate != null) { Expression body = compiledNamedTemplate.getBody(); ContextItemStaticInfo cisi = getConfiguration().makeContextItemStaticInfo(requiredContextItemType, mayOmitContextItem); Logger err = getConfiguration().getLogger(); err.info("Optimized expression tree for named template at line " + getLineNumber() + " in " + getSystemId() + ':'); Optimizer opt = getConfiguration().obtainOptimizer(); try { for (Rule r : compiledTemplateRule.getRules()) { Pattern match = r.getPattern(); ContextItemStaticInfo info = getConfiguration().makeContextItemStaticInfo(match.getItemType(), false); info.setContextPostureStriding(); Pattern m2 = match.optimize(visitor, info); Logger err = getConfiguration().getLogger(); err.info("Optimized expression tree for template rule at line " + getLineNumber() + " in " + getSystemId() + ':');
private void compileNamedTemplate(Compilation compilation, Expression body, ComponentDeclaration decl) throws XPathException { RetainedStaticContext rsc = body.getRetainedStaticContext(); compiledNamedTemplate.setPackageData(rsc.getPackageData()); compiledNamedTemplate.setBody(body); compiledNamedTemplate.setStackFrameMap(stackFrameMap); compiledNamedTemplate.setSystemId(getSystemId()); compiledNamedTemplate.setLineNumber(getLineNumber()); compiledNamedTemplate.setHasRequiredParams(hasRequiredParams); compiledNamedTemplate.setRequiredType(requiredType); compiledNamedTemplate.setContextItemRequirements(requiredContextItemType, mayOmitContextItem, absentFocus); compiledNamedTemplate.setRetainedStaticContext(rsc); compiledNamedTemplate.setDeclaredVisibility(getDeclaredVisibility()); Component overridden = getOverriddenComponent(); if (overridden != null) { checkCompatibility(overridden); } ContextItemStaticInfo cisi = getConfiguration().makeContextItemStaticInfo(requiredContextItemType, mayOmitContextItem); Expression body2 = refineTemplateBody(body, cisi); compiledNamedTemplate.setBody(body2); }
private void compileNamedTemplate(Compilation compilation, Expression body, ComponentDeclaration decl) throws XPathException { RetainedStaticContext rsc = body.getRetainedStaticContext(); compiledNamedTemplate.setPackageData(rsc.getPackageData()); compiledNamedTemplate.setBody(body); compiledNamedTemplate.setStackFrameMap(stackFrameMap); compiledNamedTemplate.setSystemId(getSystemId()); compiledNamedTemplate.setLineNumber(getLineNumber()); compiledNamedTemplate.setHasRequiredParams(hasRequiredParams); compiledNamedTemplate.setRequiredType(requiredType); compiledNamedTemplate.setContextItemRequirements(requiredContextItemType, mayOmitContextItem, absentFocus); compiledNamedTemplate.setRetainedStaticContext(rsc); compiledNamedTemplate.setDeclaredVisibility(getDeclaredVisibility()); Component overridden = getOverriddenComponent(); if (overridden != null) { checkCompatibility(overridden); } ContextItemStaticInfo cisi = getConfiguration().makeContextItemStaticInfo(requiredContextItemType, mayOmitContextItem); Expression body2 = refineTemplateBody(body, cisi); compiledNamedTemplate.setBody(body2); }
Configuration config = getConfiguration(); if (visibility != Visibility.ABSTRACT) { try {
Configuration config = getConfiguration(); if (visibility != Visibility.ABSTRACT) { try {
public void validate(ComponentDeclaration decl) throws XPathException { stackFrameMap = getConfiguration().makeSlotManager(); checkTopLevel("XTSE0010", true);
public void validate(ComponentDeclaration decl) throws XPathException { stackFrameMap = getConfiguration().makeSlotManager(); checkTopLevel("XTSE0010", true);