AttributeCollection atts = getAttributeList(); for (int a = 0; a < atts.getLength(); a++) { String f = getNamePool().getClarkName(nc); if (f.equals(StandardNames.VERSION)) { defaultValidation = Validation.getCode(atts.getValue(a)); if (defaultValidation == Validation.INVALID) { compileError("Invalid value for default-validation attribute. " + "Permitted values are (strict, lax, preserve, strip)", "XTSE0020"); } else if (!getConfiguration().isSchemaAware(Configuration.XSLT) && defaultValidation != Validation.STRIP) { compileError("default-validation='" + atts.getValue(a) + "' requires a schema-aware processor", "XTSE1660"); allowAllBuiltInTypesAtt = atts.getValue(a); } else { checkUnknownAttribute(nc); reportAbsence("version"); setInputTypeAnnotations(ANNOTATION_STRIP); } else if (inputTypeAnnotationsAtt.equals("preserve")) { setInputTypeAnnotations(ANNOTATION_PRESERVE); } else if (inputTypeAnnotationsAtt.equals("unspecified")) { compileError("Invalid value for input-type-annotations attribute. " + "Permitted values are (strip, preserve, unspecified)", "XTSE0020");
processDefaultCollationAttribute(); processDefaultMode(); String inputTypeAnnotationsAtt = null; AttributeCollection atts = getAttributeList(); for (int a = 0; a < atts.getLength(); a++) { break; default: checkUnknownAttribute(atts.getNodeName(a)); break; if (version == -1 && (getParent() == null || getParent().getNodeKind() == Type.DOCUMENT)) { reportAbsence("version"); invalidAttribute("input-type-annotations", "strip|preserve|unspecified"); break;
spliceIncludes(); buildIndexes(); processAllAttributes(); collectNamespaceAliases(); validate(); for (int i = 0; i < topLevel.size(); i++) { Object node = topLevel.get(i);
/** * Get the value of the input-type-annotations attribute, for this module alone. * The value is an or-ed combination of the two bits * {@link #ANNOTATION_STRIP} and {@link #ANNOTATION_PRESERVE} * @return the value if the input-type-annotations attribute in this stylesheet module */ public int getInputTypeAnnotationsAttribute() throws XPathException { String inputTypeAnnotationsAtt = getAttributeValue(StandardNames.INPUT_TYPE_ANNOTATIONS); if (inputTypeAnnotationsAtt != null) { if (inputTypeAnnotationsAtt.equals("strip")) { setInputTypeAnnotations(ANNOTATION_STRIP); } else if (inputTypeAnnotationsAtt.equals("preserve")) { setInputTypeAnnotations(ANNOTATION_PRESERVE); } else if (inputTypeAnnotationsAtt.equals("unspecified")) { // } else { compileError("Invalid value for input-type-annotations attribute. " + "Permitted values are (strip, preserve, unspecified)", "XTSE0020"); } } return inputAnnotations; }
/** * Process the attributes of every node in the stylesheet */ public void processAllAttributes() throws XPathException { processDefaultCollationAttribute(StandardNames.DEFAULT_COLLATION); prepareAttributes(); if (topLevel == null) return; // can happen if xsl:stylesheet appears in the wrong place for (int i = 0; i < topLevel.size(); i++) { Object s = topLevel.get(i); if (s instanceof StyleElement) { try { ((StyleElement) s).processAllAttributes(); } catch (XPathException err) { ((StyleElement) s).compileError(err); } } } }
while (qf.hasNext()) { XQueryFunction f = (XQueryFunction) qf.next(); f.fixupReferences(getStaticContext()); compileError(e); inst.setLocationId(allocateLocationId(getSystemId(), snode.getLineNumber())); exec.getDecimalFormatManager().fixupDefaultDefault(); } catch (XPathException err) { compileError(err.getMessage(), err.getErrorCodeLocalPart()); exec.setStripsWhitespace(stripsWhitespace()); Properties props = gatherOutputProperties(null); props.setProperty(SaxonOutputKeys.STYLESHEET_VERSION, getVersion().toString()); exec.setDefaultOutputProperties(props); compileError("The stylesheet contains xsl:result-document instructions that calculate the output " + "format name at run-time, but there are no named xsl:output declarations", "XTDE1460"); for (Iterator iter = outputNames.iterator(); iter.hasNext();) { StructuredQName qName = (StructuredQName)iter.next(); Properties oprops = gatherOutputProperties(qName); if (needsDynamicOutputProperties) { exec.setOutputProperties(qName, oprops); ExecutableFunctionLibrary overriding = new ExecutableFunctionLibrary(getConfiguration()); ExecutableFunctionLibrary underriding = new ExecutableFunctionLibrary(getConfiguration());
compileError(validationError); if (getParent() != null && getParent().getNodeKind() != Type.DOCUMENT) { compileError(getDisplayName() + " must be the outermost element", "XTSE0010"); AxisIterator kids = iterateAxis(AxisInfo.CHILD); NodeInfo curr; while ((curr = kids.next()) != null) { assert curr instanceof StyleElement; ((StyleElement) curr).compileError("Element " + curr.getDisplayName() + " must not appear directly within " + getDisplayName(), "XTSE0010"); } else { assert curr instanceof StyleElement; ((StyleElement) curr).compileError("Element " + curr.getDisplayName() + " must not appear directly within " + getDisplayName() + " because it is not in a namespace", "XTSE0130");
if (source.getSystemId().equals(anc.getSystemId())) { compileError("A stylesheet cannot " + getLocalPart() + " itself", (this instanceof XSLInclude ? "XTSE0180" : "XTSE0210")); return null; anc = anc.getImporter(); incSheet.validate(); incSheet.compileError(incSheet.validationError); } else if (incSheet.reportingCircumstances == REPORT_UNLESS_FORWARDS_COMPATIBLE incSheet.compileError(incSheet.validationError); incSheet.setPrecedence(precedence); incSheet.setImporter(importer); incSheet.spliceIncludes(); // resolve any nested includes; thisSheet.setInputTypeAnnotations(incSheet.getInputTypeAnnotationsAttribute() | incSheet.getInputTypeAnnotations());
StyleElement previousElement = this; AxisIterator kids = iterateAxis(Axis.CHILD); precedence = inc.getPrecedence() + 1; } else { precedence = inc.getPrecedence(); inc.setMinImportPrecedence(minImportPrecedence); inc.setWasIncluded();
incModule.setImporter(importer); ComponentDeclaration decl = new ComponentDeclaration(incModule, includedSheet); includedSheet.validate(decl); includedSheet.compileError(includedSheet.validationError); } else if (includedSheet.reportingCircumstances == REPORT_UNLESS_FORWARDS_COMPATIBLE includedSheet.compileError(includedSheet.validationError); importer.setInputTypeAnnotations(includedSheet.getInputTypeAnnotationsAttribute() | incModule.getInputTypeAnnotations());
/** * Set the value of the input-type-annotations attribute, for this module combined with that * of all included/imported modules. The value is an or-ed combination of the two bits * {@link #ANNOTATION_STRIP} and {@link #ANNOTATION_PRESERVE} * @param annotations the value of the input-type-annotations attribute, for this module combined with that * of all included/imported modules. */ public void setInputTypeAnnotations(int annotations) throws XPathException { inputAnnotations |= annotations; if (inputAnnotations == (ANNOTATION_STRIP | ANNOTATION_PRESERVE)) { compileError("One stylesheet module specifies input-type-annotations='strip', " + "another specifies input-type-annotations='preserve'", "XTSE0265"); } }
return new XSLPreserveSpace(); case StandardNames.XSL_STYLESHEET: return new XSLStylesheet(); case StandardNames.XSL_TEMPLATE: return new XSLTemplate(); return new XSLText(); case StandardNames.XSL_TRANSFORM: return new XSLStylesheet(); case StandardNames.XSL_VALUE_OF: return new XSLValueOf();
while (qf.hasNext()) { XQueryFunction f = (XQueryFunction) qf.next(); f.fixupReferences(getStaticContext()); compileError(e); inst.setLocationId(allocateLocationId(getSystemId(), snode.getLineNumber())); exec.getDecimalFormatManager().fixupDefaultDefault(); } catch (XPathException err) { compileError(err.getMessage(), err.getErrorCodeLocalPart()); exec.setStripsWhitespace(stripsWhitespace()); Properties props = gatherOutputProperties(null); props.setProperty(SaxonOutputKeys.STYLESHEET_VERSION, getVersion().toString()); exec.setDefaultOutputProperties(props); compileError("The stylesheet contains xsl:result-document instructions that calculate the output " + "format name at run-time, but there are no named xsl:output declarations", "XTDE1460"); for (Iterator iter = outputNames.iterator(); iter.hasNext();) { StructuredQName qName = (StructuredQName)iter.next(); Properties oprops = gatherOutputProperties(qName); if (needsDynamicOutputProperties) { exec.setOutputProperties(qName, oprops); ExecutableFunctionLibrary overriding = new ExecutableFunctionLibrary(getConfiguration()); ExecutableFunctionLibrary underriding = new ExecutableFunctionLibrary(getConfiguration());
compileError(validationError); if (getParent().getNodeKind() != Type.DOCUMENT) { compileError(getDisplayName() + " must be the outermost element", "XTSE0010"); AxisIterator kids = iterateAxis(AxisInfo.CHILD); NodeInfo curr; while ((curr = kids.next()) != null) { " must not appear directly within " + getDisplayName(), "XTSE0010"); } else { ((StyleElement) curr).compileError("Element " + curr.getDisplayName() + " must not appear directly within " + getDisplayName() + " because it is not in a namespace", "XTSE0130");
if (source.getSystemId().equals(anc.getSystemId())) { compileError("A stylesheet cannot " + getLocalPart() + " itself", (this instanceof XSLInclude ? "XTSE0180" : "XTSE0210")); return null; anc = anc.getImporter(); incSheet.validate(); // bug 2003065 if (incSheet.validationError!=null) { if (reportingCircumstances == REPORT_ALWAYS) { incSheet.compileError(incSheet.validationError); } else if (incSheet.reportingCircumstances == REPORT_UNLESS_FORWARDS_COMPATIBLE incSheet.compileError(incSheet.validationError); incSheet.setPrecedence(precedence); incSheet.setImporter(importer); incSheet.spliceIncludes(); // resolve any nested includes; thisSheet.setInputTypeAnnotations(incSheet.getInputTypeAnnotationsAttribute() | incSheet.getInputTypeAnnotations());
StyleElement previousElement = this; AxisIterator kids = iterateAxis(Axis.CHILD); precedence = inc.getPrecedence() + 1; } else { precedence = inc.getPrecedence(); inc.setMinImportPrecedence(minImportPrecedence); inc.setWasIncluded();
incModule.setImporter(importer); ComponentDeclaration decl = new ComponentDeclaration(incModule, includedSheet); includedSheet.validate(decl); includedSheet.compileError(includedSheet.validationError); } else if (includedSheet.reportingCircumstances == REPORT_UNLESS_FORWARDS_COMPATIBLE includedSheet.compileError(includedSheet.validationError); importer.setInputTypeAnnotations(includedSheet.getInputTypeAnnotationsAttribute() | incModule.getInputTypeAnnotations());
/** * Get the value of the input-type-annotations attribute, for this module alone. * The value is an or-ed combination of the two bits * {@link #ANNOTATION_STRIP} and {@link #ANNOTATION_PRESERVE} * @return the value if the input-type-annotations attribute in this stylesheet module */ public int getInputTypeAnnotationsAttribute() throws XPathException { String inputTypeAnnotationsAtt = getAttributeValue(StandardNames.INPUT_TYPE_ANNOTATIONS); if (inputTypeAnnotationsAtt != null) { if (inputTypeAnnotationsAtt.equals("strip")) { setInputTypeAnnotations(ANNOTATION_STRIP); } else if (inputTypeAnnotationsAtt.equals("preserve")) { setInputTypeAnnotations(ANNOTATION_PRESERVE); } else if (inputTypeAnnotationsAtt.equals("unspecified")) { // } else { compileError("Invalid value for input-type-annotations attribute. " + "Permitted values are (strip, preserve, unspecified)", "XTSE0020"); } } return inputAnnotations; }
/** * Process the attributes of every node in the stylesheet */ public void processAllAttributes() throws XPathException { processDefaultCollationAttribute(StandardNames.DEFAULT_COLLATION); prepareAttributes(); if (topLevel == null) return; // can happen if xsl:stylesheet appears in the wrong place for (int i = 0; i < topLevel.size(); i++) { Object s = topLevel.get(i); if (s instanceof StyleElement) { try { ((StyleElement) s).processAllAttributes(); } catch (XPathException err) { ((StyleElement) s).compileError(err); } } } }
/** * Set the value of the input-type-annotations attribute, for this module combined with that * of all included/imported modules. The value is an or-ed combination of the two bits * {@link #ANNOTATION_STRIP} and {@link #ANNOTATION_PRESERVE} * @param annotations the value of the input-type-annotations attribute, for this module combined with that * of all included/imported modules. */ public void setInputTypeAnnotations(int annotations) throws XPathException { inputAnnotations |= annotations; if (inputAnnotations == (ANNOTATION_STRIP | ANNOTATION_PRESERVE)) { compileError("One stylesheet module specifies input-type-annotations='strip', " + "another specifies input-type-annotations='preserve'", "XTSE0265"); } }