/** * Return a string representation of this SequenceType suitable for use in stylesheet * export files. This differs from the result of toString() in that it will not contain * any references to anonymous types. Note that it may also use the Saxon extended syntax * for union types and tuple types. * * @return the string representation as an instance of the XPath SequenceType construct */ public String toExportString() { if (cardinality == StaticProperty.ALLOWS_ZERO) { return "empty-sequence()"; } else { return primaryType.toExportString() + Cardinality.getOccurrenceIndicator(cardinality); } }
/** * Return a string representation of this SequenceType suitable for use in stylesheet * export files. This differs from the result of toString() in that it will not contain * any references to anonymous types. Note that it may also use the Saxon extended syntax * for union types and tuple types. * * @return the string representation as an instance of the XPath SequenceType construct */ public String toExportString() { if (cardinality == StaticProperty.ALLOWS_ZERO) { return "empty-sequence()"; } else { return primaryType.toExportString() + Cardinality.getOccurrenceIndicator(cardinality); } }
public void export(ExpressionPresenter presenter) throws XPathException { presenter.startElement("p.nodeSet"); if (itemType != null) { presenter.emitAttribute("type", itemType.toExportString()); } getSelectionExpression().export(presenter); presenter.endElement(); }
public void export(ExpressionPresenter presenter) throws XPathException { presenter.startElement("p.nodeSet"); if (itemType != null) { presenter.emitAttribute("type", itemType.toExportString()); } getSelectionExpression().export(presenter); presenter.endElement(); }
private static void exportRule(Rule rule, ExpressionPresenter presenter) { String which = rule.getAction() == Stripper.STRIP ? "s" : "p"; presenter.startElement(which); presenter.emitAttribute("test", rule.getPattern().getItemType().toExportString()); presenter.emitAttribute("prec", rule.getPrecedence()+""); presenter.endElement(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void export(ExpressionPresenter destination) throws XPathException { destination.startElement("dot", this); ItemType type = getItemType(); if (!(type == AnyItemType.getInstance())) { destination.emitAttribute("type", type.toExportString()); } if (staticInfo.isPossiblyAbsent()) { destination.emitAttribute("flags", "a"); } destination.endElement(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void export(ExpressionPresenter destination) throws XPathException { destination.startElement("dot", this); ItemType type = getItemType(); if (!(type == AnyItemType.getInstance())) { destination.emitAttribute("type", type.toExportString()); } if (staticInfo.isPossiblyAbsent()) { destination.emitAttribute("flags", "a"); } destination.endElement(); }
private static void exportRule(Rule rule, ExpressionPresenter presenter) { String which = rule.getAction() == Stripper.STRIP ? "s" : "p"; presenter.startElement(which); presenter.emitAttribute("test", rule.getPattern().getItemType().toExportString()); presenter.emitAttribute("prec", rule.getPrecedence()+""); presenter.endElement(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void export(ExpressionPresenter out) throws XPathException { out.startElement("treat", this); out.emitAttribute("as", requiredItemType.toExportString()); if ("JS".equals(((ExpressionPresenter.ExportOptions) out.getOptions()).target)) { int targetVersion = ((ExpressionPresenter.ExportOptions) out.getOptions()).targetVersion; out.emitAttribute("jsTest", requiredItemType.generateJavaScriptItemTypeTest(getBaseExpression().getItemType(), targetVersion)); } out.emitAttribute("diag", role.save()); getBaseExpression().export(out); out.endElement(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void export(ExpressionPresenter out) throws XPathException { out.startElement("instance", this); if (targetCardinality == StaticProperty.ALLOWS_ZERO) { out.emitAttribute("of", "empty-sequence()"); } else { out.emitAttribute("of", targetType.toExportString() + Cardinality.getOccurrenceIndicator(targetCardinality)); } if ("JS".equals(((ExpressionPresenter.ExportOptions) out.getOptions()).target)) { int targetVersion = ((ExpressionPresenter.ExportOptions) out.getOptions()).targetVersion; out.emitAttribute("jsTest", targetType.generateJavaScriptItemTypeTest(getBaseExpression().getItemType(), targetVersion)); } getBaseExpression().export(out); out.endElement(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void export(ExpressionPresenter out) throws XPathException { out.startElement("instance", this); if (targetCardinality == StaticProperty.ALLOWS_ZERO) { out.emitAttribute("of", "empty-sequence()"); } else { out.emitAttribute("of", targetType.toExportString() + Cardinality.getOccurrenceIndicator(targetCardinality)); } if ("JS".equals(((ExpressionPresenter.ExportOptions) out.getOptions()).target)) { int targetVersion = ((ExpressionPresenter.ExportOptions) out.getOptions()).targetVersion; out.emitAttribute("jsTest", targetType.generateJavaScriptItemTypeTest(getBaseExpression().getItemType(), targetVersion)); } getBaseExpression().export(out); out.endElement(); }
/** * Export the global context item declaration to an SEF export file * @param out the export destination * @throws XPathException if things go wrong */ public void export(ExpressionPresenter out) throws XPathException { out.startElement("glob"); String use; if (isMayBeOmitted()) { if (isAbsentFocus()) { use = "pro"; } else { use = "opt"; } } else { use = "req"; } out.emitAttribute("use", use); if (!getRequiredItemType().equals(AnyItemType.getInstance())) { out.emitAttribute("type", getRequiredItemType().toExportString()); } if ("JS".equals(((ExpressionPresenter.ExportOptions) out.getOptions()).target)) { int targetVersion = ((ExpressionPresenter.ExportOptions) out.getOptions()).targetVersion; out.emitAttribute("jsTest", getRequiredItemType().generateJavaScriptItemTypeTest( AnyItemType.getInstance(), targetVersion)); } out.endElement(); }
/** * Export the global context item declaration to an SEF export file * @param out the export destination * @throws XPathException if things go wrong */ public void export(ExpressionPresenter out) throws XPathException { out.startElement("glob"); String use; if (isMayBeOmitted()) { if (isAbsentFocus()) { use = "pro"; } else { use = "opt"; } } else { use = "req"; } out.emitAttribute("use", use); if (!getRequiredItemType().equals(AnyItemType.getInstance())) { out.emitAttribute("type", getRequiredItemType().toExportString()); } if ("JS".equals(((ExpressionPresenter.ExportOptions) out.getOptions()).target)) { int targetVersion = ((ExpressionPresenter.ExportOptions) out.getOptions()).targetVersion; out.emitAttribute("jsTest", getRequiredItemType().generateJavaScriptItemTypeTest( AnyItemType.getInstance(), targetVersion)); } out.endElement(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void export(ExpressionPresenter out) throws XPathException { out.startElement("treat", this); out.emitAttribute("as", requiredItemType.toExportString()); ExpressionPresenter.ExportOptions options = (ExpressionPresenter.ExportOptions) out.getOptions(); if ("JS".equals(options.target)) { int targetVersion = options.targetVersion; out.emitAttribute("jsTest", requiredItemType.generateJavaScriptItemTypeTest(getBaseExpression().getItemType(), targetVersion)); if (targetVersion == 2) { SequenceType st = SequenceType.makeSequenceType(requiredItemType, StaticProperty.EXACTLY_ONE); out.emitAttribute("asJ", st.toExportString2()); } } out.emitAttribute("diag", role.save()); getBaseExpression().export(out); out.endElement(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void export(ExpressionPresenter destination) throws XPathException { destination.startElement("convert", this); destination.emitAttribute("from", getBaseExpression().getItemType().toExportString()); destination.emitAttribute("to", requiredItemType.toExportString()); if (converter instanceof Converter.PromoterToDouble || converter instanceof Converter.PromoterToFloat) { destination.emitAttribute("flags", "p"); } if (getRoleDiagnostic() != null) { destination.emitAttribute("diag", getRoleDiagnostic().save()); } getBaseExpression().export(destination); destination.endElement(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void export(ExpressionPresenter destination) throws XPathException { destination.startElement("convert", this); destination.emitAttribute("from", getBaseExpression().getItemType().toExportString()); destination.emitAttribute("to", requiredItemType.toExportString()); if (converter instanceof Converter.PromoterToDouble || converter instanceof Converter.PromoterToFloat) { destination.emitAttribute("flags", "p"); } if (getRoleDiagnostic() != null) { destination.emitAttribute("diag", getRoleDiagnostic().save()); } getBaseExpression().export(destination); destination.endElement(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void export(ExpressionPresenter out) throws XPathException { out.startElement("for", this); explainSpecializedAttributes(out); out.emitAttribute("var", getVariableQName()); out.emitAttribute("as", getSequence().getItemType().toExportString()); out.emitAttribute("slot", "" + getLocalSlotNumber()); out.setChildRole("in"); getSequence().export(out); out.setChildRole("return"); getAction().export(out); out.endElement(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void export(ExpressionPresenter out) throws XPathException { out.startElement("for", this); explainSpecializedAttributes(out); out.emitAttribute("var", getVariableQName()); out.emitAttribute("as", getSequence().getItemType().toExportString()); out.emitAttribute("slot", "" + getLocalSlotNumber()); out.setChildRole("in"); getSequence().export(out); out.setChildRole("return"); getAction().export(out); out.endElement(); }
public void explainProperties(ExpressionPresenter presenter) throws XPathException { if (getRequiredContextItemType() != AnyItemType.getInstance()) { presenter.emitAttribute("cxt", getRequiredContextItemType().toExportString()); if ("JS".equals(((ExpressionPresenter.ExportOptions) presenter.getOptions()).target)) { try { int targetVersion = ((ExpressionPresenter.ExportOptions) presenter.getOptions()).targetVersion; presenter.emitAttribute("jsTest", getRequiredContextItemType().generateJavaScriptItemTypeTest(AnyItemType.getInstance(), targetVersion)); } catch (XPathException e) { e.maybeSetLocation(getLocation()); throw e; } } } String flags = ""; if (mayOmitContextItem) { flags = "o"; } if (!absentFocus) { flags += "s"; } presenter.emitAttribute("flags", flags); if (getRequiredType() != SequenceType.ANY_SEQUENCE) { presenter.emitAttribute("as", getRequiredType().toExportString()); } presenter.emitAttribute("line", getLineNumber() + ""); presenter.emitAttribute("module", getSystemId()); }
public void explainProperties(ExpressionPresenter presenter) throws XPathException { if (getRequiredContextItemType() != AnyItemType.getInstance()) { presenter.emitAttribute("cxt", getRequiredContextItemType().toExportString()); if ("JS".equals(((ExpressionPresenter.ExportOptions) presenter.getOptions()).target)) { try { int targetVersion = ((ExpressionPresenter.ExportOptions) presenter.getOptions()).targetVersion; presenter.emitAttribute("jsTest", getRequiredContextItemType().generateJavaScriptItemTypeTest(AnyItemType.getInstance(), targetVersion)); } catch (XPathException e) { e.maybeSetLocation(getLocation()); throw e; } } } String flags = ""; if (mayOmitContextItem) { flags = "o"; } if (!absentFocus) { flags += "s"; } presenter.emitAttribute("flags", flags); if (getRequiredType() != SequenceType.ANY_SEQUENCE) { presenter.emitAttribute("as", getRequiredType().toExportString()); } presenter.emitAttribute("line", getLineNumber() + ""); presenter.emitAttribute("module", getSystemId()); }