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; }
private NamedTemplate findTemplate(StructuredQName templateName) throws XPathException { PrincipalStylesheetModule pack = getPrincipalStylesheetModule(); NamedTemplate template = pack.getNamedTemplate(templateName); if (template == null) { if (templateName.hasURI(NamespaceConstant.XSLT) && templateName.getLocalPart().equals("original")) { // Handle xsl:original return (NamedTemplate) getXslOriginal(StandardNames.XSL_TEMPLATE); } compileError("Cannot find a template named " + calledTemplateName, "XTSE0650"); } return template; }
private NamedTemplate findTemplate(StructuredQName templateName) throws XPathException { PrincipalStylesheetModule pack = getPrincipalStylesheetModule(); NamedTemplate template = pack.getNamedTemplate(templateName); if (template == null) { if (templateName.hasURI(NamespaceConstant.XSLT) && templateName.getLocalPart().equals("original")) { // Handle xsl:original return (NamedTemplate) getXslOriginal(StandardNames.XSL_TEMPLATE); } compileError("Cannot find a template named " + calledTemplateName, "XTSE0650"); } return template; }
compileError("No character data is allowed within xsl:call-template", "XTSE0010"); compileError("Child element " + Err.wrap(child.getDisplayName(), Err.ELEMENT) + " is not allowed within xsl:call-template", "XTSE0010");
public void validate(ComponentDeclaration decl) throws XPathException { AxisIterator kids = iterateAxis(AxisInfo.CHILD); while (true) { NodeInfo child = kids.next(); if (child == null) { break; } if (child instanceof XSLWithParam) { // OK; } else if (child instanceof XSLFallback && mayContainFallback()) { // xsl:fallback is not allowed on xsl:call-template, but is allowed on saxon:call-template (cheat!) } else if (child.getNodeKind() == Type.TEXT) { // with xml:space=preserve, white space nodes may still be there if (!Whitespace.isWhite(child.getStringValueCS())) { compileError("No character data is allowed within xsl:call-template", "XTSE0010"); } } else { compileError("Child element " + Err.wrap(child.getDisplayName(), Err.ELEMENT) + " is not allowed as a child of xsl:call-template", "XTSE0010"); } } if (!calledTemplateName.equals(ERROR_TEMPLATE_NAME)) { template = findTemplate(calledTemplateName); } }
public void validate(ComponentDeclaration decl) throws XPathException { AxisIterator kids = iterateAxis(AxisInfo.CHILD); while (true) { NodeInfo child = kids.next(); if (child == null) { break; } if (child instanceof XSLWithParam) { // OK; } else if (child instanceof XSLFallback && mayContainFallback()) { // xsl:fallback is not allowed on xsl:call-template, but is allowed on saxon:call-template (cheat!) } else if (child.getNodeKind() == Type.TEXT) { // with xml:space=preserve, white space nodes may still be there if (!Whitespace.isWhite(child.getStringValueCS())) { compileError("No character data is allowed within xsl:call-template", "XTSE0010"); } } else { compileError("Child element " + Err.wrap(child.getDisplayName(), Err.ELEMENT) + " is not allowed as a child of xsl:call-template", "XTSE0010"); } } if (!calledTemplateName.equals(ERROR_TEMPLATE_NAME)) { template = findTemplate(calledTemplateName); } }
public void validate() throws XPathException { AxisIterator kids = iterateAxis(Axis.CHILD); while (true) { NodeInfo child = (NodeInfo)kids.next(); if (child == null) { break; } if (child instanceof XSLWithParam) { // OK; } else if (child instanceof XSLFallback && mayContainFallback()) { // xsl:fallback is not allowed on xsl:call-template, but is allowed on saxon:call-template (cheat!) } else if (child.getNodeKind() == Type.TEXT) { // with xml:space=preserve, white space nodes may still be there if (!Whitespace.isWhite(child.getStringValueCS())) { compileError("No character data is allowed within xsl:call-template", "XTSE0010"); } } else { compileError("Child element " + Err.wrap(child.getDisplayName(), Err.ELEMENT) + " is not allowed within xsl:call-template", "XTSE0010"); } } if (calledTemplateExpression==null) { template = findTemplate(calledTemplateName); if (template==null) { return; } } calledTemplateExpression = typeCheck("name", calledTemplateExpression); }
} catch (NamespaceException err) { calledTemplateName = new StructuredQName("saxon", NamespaceConstant.SAXON, "error-template"); compileError(err.getMessage(), "XTSE0280"); } catch (XPathException err) { calledTemplateName = new StructuredQName("saxon", NamespaceConstant.SAXON, "error-template"); compileError(err.getMessage(), "XTSE0280");
} catch (NamespaceException err) { calledTemplateName = new StructuredQName("saxon", NamespaceConstant.SAXON, "error-template"); compileError(err.getMessage(), "XTSE0280"); } catch (XPathException err) { calledTemplateName = new StructuredQName("saxon", NamespaceConstant.SAXON, "error-template"); compileError(err.getMessage(), err.getErrorCodeLocalPart());
compileError("No value supplied for required parameter " + Err.wrap(param.name.getDisplayName(), Err.VARIABLE), "XTSE0690"); compileError("Parameter " + withParam.getVariableQName().getDisplayName() + " is not declared in the called template", "XTSE0680");
compileError("No value supplied for required parameter " + Err.wrap(param.name.getDisplayName(), Err.VARIABLE), "XTSE0690"); compileError("Parameter " + withParam.getVariableQName().getDisplayName() + " is not declared in the called template", "XTSE0680");
compileError("No value supplied for required parameter " + Err.wrap(((XSLParam)param).getVariableDisplayName(), Err.VARIABLE), "XTSE0690"); compileError("Parameter " + withParam.getVariableDisplayName() + " is not declared in the called template", "XTSE0680");
compileError("No value supplied for required parameter " + Err.wrap(((XSLParam)param).getVariableDisplayName(), Err.VARIABLE), "XTSE0690"); compileError("Parameter " + withParam.getVariableDisplayName() + " is not declared in the called template", "XTSE0680");