/** * Determine if an extension element is available * * @throws XPathException if the name is invalid or the prefix is not declared */ public boolean isElementAvailable(String qname) throws XPathException { try { String[] parts = NameChecker.getQNameParts(qname); String uri; if (parts[0].isEmpty()) { uri = getDefaultElementNamespace(); } else { uri = element.getURIForPrefix(parts[0], false); } return element.getCompilation().getStyleNodeFactory(true).isElementAvailable(uri, parts[1], true); } catch (QNameException e) { XPathException err = new XPathException("Invalid element name. " + e.getMessage()); err.setErrorCode("XTDE1440"); throw err; } }
/** * Determine if an extension element is available * * @throws XPathException if the name is invalid or the prefix is not declared */ public boolean isElementAvailable(String qname) throws XPathException { try { String[] parts = NameChecker.getQNameParts(qname); String uri; if (parts[0].isEmpty()) { uri = getDefaultElementNamespace(); } else { uri = element.getURIForPrefix(parts[0], false); } return element.getCompilation().getStyleNodeFactory(true).isElementAvailable(uri, parts[1], true); } catch (QNameException e) { XPathException err = new XPathException("Invalid element name. " + e.getMessage()); err.setErrorCode("XTDE1440"); throw err; } }
/** * Create a TemplatesHandlerImpl and initialise variables. The constructor is protected, because * the Filter should be created using newTemplatesHandler() in the SAXTransformerFactory * class * * @param processor the Saxon s9api processor */ protected TemplatesHandlerImpl(Processor processor) { this.processor = processor; Configuration config = processor.getUnderlyingConfiguration(); setPipelineConfiguration(config.makePipelineConfiguration()); CompilerInfo info = new CompilerInfo(config.getDefaultXsltCompilerInfo()); Compilation compilation = new Compilation(config, info); nodeFactory = compilation.getStyleNodeFactory(true); builder = new LinkedTreeBuilder(getPipelineConfiguration()); builder.setNodeFactory(nodeFactory); builder.setLineNumbering(true); UseWhenFilter useWhenFilter = new UseWhenFilter(compilation, builder, NestedIntegerValue.TWO); StartTagBuffer startTagBuffer = new StartTagBuffer(useWhenFilter); useWhenFilter.setStartTagBuffer(startTagBuffer); StylesheetSpaceStrippingRule rule = new StylesheetSpaceStrippingRule(config.getNamePool()); Stripper styleStripper = new Stripper(rule, startTagBuffer); CommentStripper commentStripper = new CommentStripper(styleStripper); setReceiver(commentStripper); }
/** * Create a TemplatesHandlerImpl and initialise variables. The constructor is protected, because * the Filter should be created using newTemplatesHandler() in the SAXTransformerFactory * class * * @param processor the Saxon s9api processor */ protected TemplatesHandlerImpl(Processor processor) { this.processor = processor; Configuration config = processor.getUnderlyingConfiguration(); setPipelineConfiguration(config.makePipelineConfiguration()); CompilerInfo info = new CompilerInfo(config.getDefaultXsltCompilerInfo()); Compilation compilation = new Compilation(config, info); nodeFactory = compilation.getStyleNodeFactory(true); builder = new LinkedTreeBuilder(getPipelineConfiguration()); builder.setNodeFactory(nodeFactory); builder.setLineNumbering(true); UseWhenFilter useWhenFilter = new UseWhenFilter(compilation, builder, NestedIntegerValue.TWO); StartTagBuffer startTagBuffer = new StartTagBuffer(useWhenFilter); useWhenFilter.setStartTagBuffer(startTagBuffer); StylesheetSpaceStrippingRule rule = new StylesheetSpaceStrippingRule(config.getNamePool()); Stripper styleStripper = new Stripper(rule, startTagBuffer); CommentStripper commentStripper = new CommentStripper(styleStripper); setReceiver(commentStripper); }
public void index(ComponentDeclaration decl, PrincipalStylesheetModule top) throws XPathException { if (accumulator.getAccumulatorName() == null) { prepareSimpleAttributes(); } accumulator.setImportPrecedence(decl.getPrecedence()); if (top.getAccumulatorManager() == null) { StyleNodeFactory styleNodeFactory = getCompilation().getStyleNodeFactory(true); AccumulatorRegistry manager = styleNodeFactory.makeAccumulatorManager(); top.setAccumulatorManager(manager); getCompilation().getPackageData().setAccumulatorRegistry(manager); } AccumulatorRegistry mgr = top.getAccumulatorManager(); Accumulator existing = mgr.getAccumulator(accumulator.getAccumulatorName()); if (existing != null) { int existingPrec = existing.getImportPrecedence(); if (existingPrec == decl.getPrecedence()) { compileError("There are two accumulators with the same name (" + accumulator.getAccumulatorName().getDisplayName() + ") and the same import precedence", "XTSE3350"); } if (existingPrec > decl.getPrecedence()) { return; } } mgr.addAccumulator(accumulator); }
public void index(ComponentDeclaration decl, PrincipalStylesheetModule top) throws XPathException { if (accumulator.getAccumulatorName() == null) { prepareSimpleAttributes(); } accumulator.setImportPrecedence(decl.getPrecedence()); if (top.getAccumulatorManager() == null) { StyleNodeFactory styleNodeFactory = getCompilation().getStyleNodeFactory(true); AccumulatorRegistry manager = styleNodeFactory.makeAccumulatorManager(); top.setAccumulatorManager(manager); getCompilation().getPackageData().setAccumulatorRegistry(manager); } AccumulatorRegistry mgr = top.getAccumulatorManager(); Accumulator existing = mgr.getAccumulator(accumulator.getAccumulatorName()); if (existing != null) { int existingPrec = existing.getImportPrecedence(); if (existingPrec == decl.getPrecedence()) { compileError("There are two accumulators with the same name (" + accumulator.getAccumulatorName().getDisplayName() + ") and the same import precedence", "XTSE3350"); } if (existingPrec > decl.getPrecedence()) { return; } } mgr.addAccumulator(accumulator); }
styleBuilder.setSystemId(styleSource.getSystemId()); styleBuilder.setNodeFactory(compilation.getStyleNodeFactory(topLevelModule)); styleBuilder.setLineNumbering(true);
styleBuilder.setSystemId(styleSource.getSystemId()); styleBuilder.setNodeFactory(compilation.getStyleNodeFactory(topLevelModule)); styleBuilder.setLineNumbering(true);
StyleNodeFactory nodeFactory = getCompilation().getStyleNodeFactory(topLevel); if (!isInScopeNamespace(NamespaceConstant.XSLT)) { String message;
StyleNodeFactory nodeFactory = getCompilation().getStyleNodeFactory(topLevel); if (!isInScopeNamespace(NamespaceConstant.XSLT)) { String message;
styleBuilder.setSystemId(styleSource.getSystemId()); styleBuilder.setNodeFactory(compilation.getStyleNodeFactory(true)); styleBuilder.setLineNumbering(true);
styleBuilder.setSystemId(styleSource.getSystemId()); styleBuilder.setNodeFactory(compilation.getStyleNodeFactory(true)); styleBuilder.setLineNumbering(true);
StyleNodeFactory factory = getStyleNodeFactory(true); PrincipalStylesheetModule psm = factory.newPrincipalModule(xslpackage); StylesheetPackage pack = psm.getStylesheetPackage();
StyleNodeFactory factory = getStyleNodeFactory(true); PrincipalStylesheetModule psm = factory.newPrincipalModule(xslpackage); StylesheetPackage pack = psm.getStylesheetPackage();