/** * Get the principal stylesheet module of the package in which * this XSLT element appears * * @return the containing package */ public PrincipalStylesheetModule getPrincipalStylesheetModule() { return getCompilation().getPrincipalStylesheetModule(); }
/** * Get the principal stylesheet module of the package in which * this XSLT element appears * * @return the containing package */ public PrincipalStylesheetModule getPrincipalStylesheetModule() { return getCompilation().getPrincipalStylesheetModule(); }
/** * Get the KeyManager, containing definitions of keys available for use. * * @return the KeyManager. This is used to resolve key names, both explicit calls * on key() used in XSLT, and system-generated calls on key() which may * also appear in XQuery and XPath */ public KeyManager getKeyManager() { return element.getCompilation().getPrincipalStylesheetModule().getKeyManager(); }
/** * Get a DecimalFormatManager to resolve the names of decimal formats used in calls * to the format-number() function. * * @return the decimal format manager for this static context, or null if named decimal * formats are not supported in this environment. */ public DecimalFormatManager getDecimalFormatManager() { return element.getCompilation().getPrincipalStylesheetModule().getDecimalFormatManager(); }
/** * Get a DecimalFormatManager to resolve the names of decimal formats used in calls * to the format-number() function. * * @return the decimal format manager for this static context, or null if named decimal * formats are not supported in this environment. */ public DecimalFormatManager getDecimalFormatManager() { return element.getCompilation().getPrincipalStylesheetModule().getDecimalFormatManager(); }
/** * Get the KeyManager, containing definitions of keys available for use. * * @return the KeyManager. This is used to resolve key names, both explicit calls * on key() used in XSLT, and system-generated calls on key() which may * also appear in XQuery and XPath */ public KeyManager getKeyManager() { return element.getCompilation().getPrincipalStylesheetModule().getKeyManager(); }
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); } }
/** * Process the [xsl:]default-mode attribute if there is one * * @throws net.sf.saxon.trans.XPathException if the value is not a valid EQName, or the token #unnamed */ protected void processDefaultMode() throws XPathException { String ns = getURI().equals(NamespaceConstant.XSLT) ? "" : NamespaceConstant.XSLT; String v = getAttributeValue(ns, "default-mode"); if (v != null) { if (v.equals("#unnamed")) { defaultMode = Mode.UNNAMED_MODE_NAME; } else { defaultMode = makeQName(v); // should check that this is actually a mode on a template } } PrincipalStylesheetModule psm = compilation.getPrincipalStylesheetModule(); final StructuredQName checkedName = defaultMode; if (psm != null && psm.isDeclaredModes()) { // It will be null on the xsl:package element itself psm.addFixupAction(() -> { if (psm.getRuleManager().obtainMode(checkedName, false) == null) { XPathException err = new XPathException("Mode " + checkedName.getDisplayName() + " is not declared in an xsl:mode declaration", "XTSE3085"); err.setLocation(this); throw err; } }); } }
/** * Process the [xsl:]default-mode attribute if there is one * * @throws net.sf.saxon.trans.XPathException if the value is not a valid EQName, or the token #unnamed */ protected void processDefaultMode() throws XPathException { String ns = getURI().equals(NamespaceConstant.XSLT) ? "" : NamespaceConstant.XSLT; String v = getAttributeValue(ns, "default-mode"); if (v != null) { if (v.equals("#unnamed")) { defaultMode = Mode.UNNAMED_MODE_NAME; } else { defaultMode = makeQName(v); // should check that this is actually a mode on a template } } PrincipalStylesheetModule psm = compilation.getPrincipalStylesheetModule(); final StructuredQName checkedName = defaultMode; if (psm != null && psm.isDeclaredModes()) { // It will be null on the xsl:package element itself psm.addFixupAction(() -> { if (psm.getRuleManager().obtainMode(checkedName, false) == null) { XPathException err = new XPathException("Mode " + checkedName.getDisplayName() + " is not declared in an xsl:mode declaration", "XTSE3085"); err.setLocation(this); throw err; } }); } }
/** * Method supplied by declaration elements to add themselves to a stylesheet-level index * * @param decl the Declaration being indexed. (This corresponds to the StyleElement object * except in cases where one module is imported several times with different precedence.) * @param top the outermost XSLStylesheet element */ public void index(ComponentDeclaration decl, PrincipalStylesheetModule top) throws XPathException { prepareAttributes(); DecimalFormatManager dfm = getCompilation().getPrincipalStylesheetModule().getDecimalFormatManager(); if (name == null) { symbols = dfm.getDefaultDecimalFormat(); } else { try { StructuredQName formatName = makeQName(name); symbols = dfm.obtainNamedDecimalFormat(formatName); symbols.setHostLanguage(Configuration.XSLT, 30); } catch (XPathException err) { compileErrorInAttribute("Invalid decimal format name. " + err.getMessage(), "XTSE0020", "name"); } } }
/** * Method supplied by declaration elements to add themselves to a stylesheet-level index * * @param decl the Declaration being indexed. (This corresponds to the StyleElement object * except in cases where one module is imported several times with different precedence.) * @param top the outermost XSLStylesheet element */ public void index(ComponentDeclaration decl, PrincipalStylesheetModule top) throws XPathException { prepareAttributes(); DecimalFormatManager dfm = getCompilation().getPrincipalStylesheetModule().getDecimalFormatManager(); if (name == null) { symbols = dfm.getDefaultDecimalFormat(); } else { try { StructuredQName formatName = makeQName(name); symbols = dfm.obtainNamedDecimalFormat(formatName); symbols.setHostLanguage(Configuration.XSLT, 30); } catch (XPathException err) { compileErrorInAttribute("Invalid decimal format name. " + err.getMessage(), "XTSE0020", "name"); } } }
public Expression compile(Compilation compilation, ComponentDeclaration decl) throws XPathException { SortKeyDefinitionList sortKeys = makeSortKeys(compilation, decl); if (sortKeys != null) { useTailRecursion = false; } assert select != null; Expression sortedSequence = select; if (sortKeys != null) { sortedSequence = new SortExpression(select, sortKeys); } compileSequenceConstructor(compilation, decl, true); RuleManager rm = compilation.getPrincipalStylesheetModule().getRuleManager(); ApplyTemplates app = new ApplyTemplates( sortedSequence, useCurrentMode, useTailRecursion, defaultedSelectExpression, isWithinDeclaredStreamableConstruct(), mode, rm); app.setActualParams(getWithParamInstructions(app, compilation, decl, false)); app.setTunnelParams(getWithParamInstructions(app, compilation, decl, true)); return app; }
public Expression compile(Compilation compilation, ComponentDeclaration decl) throws XPathException { SortKeyDefinitionList sortKeys = makeSortKeys(compilation, decl); if (sortKeys != null) { useTailRecursion = false; } assert select != null; Expression sortedSequence = select; if (sortKeys != null) { sortedSequence = new SortExpression(select, sortKeys); } compileSequenceConstructor(compilation, decl, true); RuleManager rm = compilation.getPrincipalStylesheetModule().getRuleManager(); ApplyTemplates app = new ApplyTemplates( sortedSequence, useCurrentMode, useTailRecursion, defaultedSelectExpression, isWithinDeclaredStreamableConstruct(), mode, rm); app.setActualParams(getWithParamInstructions(app, compilation, decl, false)); app.setTunnelParams(getWithParamInstructions(app, compilation, decl, true)); return app; }
RuleManager mgr = getCompilation().getPrincipalStylesheetModule().getRuleManager(); boolean appliesToAll = false; for (StructuredQName nc : modeNames) {
RuleManager mgr = getCompilation().getPrincipalStylesheetModule().getRuleManager(); boolean appliesToAll = false; for (StructuredQName nc : modeNames) {
final PrincipalStylesheetModule psm = ((ExpressionContext) env).getStyleElement().getCompilation().getPrincipalStylesheetModule(); final ExpressionVisitor visitor = ExpressionVisitor.make(env); psm.addFixupAction(() -> {
final PrincipalStylesheetModule psm = ((ExpressionContext) env).getStyleElement().getCompilation().getPrincipalStylesheetModule(); final ExpressionVisitor visitor = ExpressionVisitor.make(env); psm.addFixupAction(() -> {
Expression exp2 = opt.promoteExpressionsToGlobal(body, compilation.getPrincipalStylesheetModule(), visitor); if (exp2 != null) {
Expression exp2 = opt.promoteExpressionsToGlobal(body, compilation.getPrincipalStylesheetModule(), visitor); if (exp2 != null) {