public SymbolicName getSymbolicName() { if (getTemplateName() == null) { return null; } else { return new SymbolicName(StandardNames.XSL_TEMPLATE, getTemplateName()); } }
public SymbolicName getSymbolicName() { if (getTemplateName() == null) { return null; } else { return new SymbolicName(StandardNames.XSL_TEMPLATE, getTemplateName()); } }
public void index(ComponentDeclaration decl, PrincipalStylesheetModule top) throws XPathException { if (getTemplateName() != null) { if (compiledNamedTemplate == null) { compiledNamedTemplate = new NamedTemplate(getTemplateName()); } top.indexNamedTemplate(decl); } }
public void index(ComponentDeclaration decl, PrincipalStylesheetModule top) throws XPathException { if (getTemplateName() != null) { if (compiledNamedTemplate == null) { compiledNamedTemplate = new NamedTemplate(getTemplateName()); } top.indexNamedTemplate(decl); } }
/** * Ask whether the compilation of the template should be deferred * * @param compilation the compilation * @return true if compilation should be deferred */ public boolean isDeferredCompilation(Compilation compilation) { return compilation.isPreScan() && getTemplateName() == null && !compilation.isLibraryPackage(); }
/** * Ask whether the compilation of the template should be deferred * * @param compilation the compilation * @return true if compilation should be deferred */ public boolean isDeferredCompilation(Compilation compilation) { return compilation.isPreScan() && getTemplateName() == null && !compilation.isLibraryPackage(); }
private XSLTemplate findTemplate(StructuredQName templateName) throws XPathException { XSLStylesheet stylesheet = getPrincipalStylesheet(); List toplevel = stylesheet.getTopLevel(); // search for a matching template name, starting at the end in case of duplicates. // this also ensures we get the one with highest import precedence. for (int i=toplevel.size()-1; i>=0; i--) { if (toplevel.get(i) instanceof XSLTemplate) { XSLTemplate t = (XSLTemplate)toplevel.get(i); if (templateName.equals(t.getTemplateName())) { return t; } } } compileError("No template exists named " + calledTemplateName, "XTSE0650"); return null; }
private XSLTemplate findTemplate(StructuredQName templateName) throws XPathException { XSLStylesheet stylesheet = getPrincipalStylesheet(); List toplevel = stylesheet.getTopLevel(); // search for a matching template name, starting at the end in case of duplicates. // this also ensures we get the one with highest import precedence. for (int i=toplevel.size()-1; i>=0; i--) { if (toplevel.get(i) instanceof XSLTemplate) { XSLTemplate t = (XSLTemplate)toplevel.get(i); if (templateName.equals(t.getTemplateName())) { return t; } } } compileError("No template exists named " + calledTemplateName, "XTSE0650"); return null; }
StructuredQName qName = template.getTemplateName(); if (qName != null) {
StructuredQName qName = template.getTemplateName(); if (qName != null) {
StructuredQName qName = template.getTemplateName(); if (qName != null) {
if (getTemplateName() != null) { try { Expression exp = compiledNamedTemplate.getBody();
if (getTemplateName() != null) { try { Expression exp = compiledNamedTemplate.getBody();
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 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(); }
/** * Check that the stylesheet element is valid. This is called once for each element, after * the entire tree has been built. As well as validation, it can perform first-time * initialisation. The default implementation does nothing; it is normally overriden * in subclasses. * * @param decl the declaration to be validated * @throws XPathException if any error is found during validation */ public void validate(ComponentDeclaration decl) throws XPathException { if (!(getParent() instanceof XSLTemplate)) { compileError("xsl:context-item can appear only as a child of xsl:template"); return; } if (mayBeOmitted && ((XSLTemplate) getParent()).getTemplateName() == null) { compileError("xsl:context-item appearing in an xsl:template declaration with no name attribute must specify use=required", "XTSE0020"); } ((XSLTemplate)getParent()).setContextItemRequirements(requiredType, mayBeOmitted, absentFocus); iterateAxis(AxisInfo.PRECEDING_SIBLING).forEachOrFail(prec -> { if (prec.getNodeKind() != Type.TEXT || !Whitespace.isWhite(prec.getStringValueCS())) { compileError("xsl:context-item must be the first child of xsl:template"); } }); }
/** * Check that the stylesheet element is valid. This is called once for each element, after * the entire tree has been built. As well as validation, it can perform first-time * initialisation. The default implementation does nothing; it is normally overriden * in subclasses. * * @param decl the declaration to be validated * @throws XPathException if any error is found during validation */ public void validate(ComponentDeclaration decl) throws XPathException { if (!(getParent() instanceof XSLTemplate)) { compileError("xsl:context-item can appear only as a child of xsl:template"); return; } if (mayBeOmitted && ((XSLTemplate) getParent()).getTemplateName() == null) { compileError("xsl:context-item appearing in an xsl:template declaration with no name attribute must specify use=required", "XTSE0020"); } ((XSLTemplate)getParent()).setContextItemRequirements(requiredType, mayBeOmitted, absentFocus); iterateAxis(AxisInfo.PRECEDING_SIBLING).forEachOrFail(prec -> { if (prec.getNodeKind() != Type.TEXT || !Whitespace.isWhite(prec.getStringValueCS())) { compileError("xsl:context-item must be the first child of xsl:template"); } }); }
checkStrictStreamability(body); if (getTemplateName() != null) { compileNamedTemplate(compilation, body, decl);
fp == StandardNames.XSL_FUNCTION || fp == StandardNames.XSL_MODE || (fp == StandardNames.XSL_TEMPLATE && ((XSLTemplate) e).getTemplateName() != null)) { Component component; if (fp == StandardNames.XSL_MODE) {
/** * Compile: creates the executable form of the template */ public void compileDeclaration(Compilation compilation, ComponentDeclaration decl) throws XPathException { if (isDeferredCompilation(compilation)) { createSkeletonTemplate(compilation, decl); //System.err.println("Deferred - " + ++lazy); return; } if (compilation.getCompilerInfo().getOptimizerOptions().isSet(OptimizerOptions.TAIL_CALLS)) { isTailRecursive = markTailCalls(); } Expression body = compileSequenceConstructor(compilation, decl, true); body.restoreParentPointers(); RetainedStaticContext rsc = makeRetainedStaticContext(); if (body.getRetainedStaticContext() == null) { body.setRetainedStaticContext(rsc); // bug 2608 } if (match != null && compilation.getConfiguration().getBooleanProperty(Feature.STRICT_STREAMABILITY) && isWithinDeclaredStreamableConstruct()) { checkStrictStreamability(body); } if (getTemplateName() != null) { compileNamedTemplate(compilation, body, decl); } if (match != null) { //System.err.println("Rules compiled - " + ++eager); compileTemplateRule(compilation, body, decl); } }