/** * Create a new Transformer object that performs a copy * of the source to the result. * * @return A Transformer object that may be used to perform a transformation * in a single thread, never null. * * @throws TransformerConfigurationException May throw this during * the parse when it is constructing the * Templates object and fails. */ public TemplatesHandler newTemplatesHandler() throws TransformerConfigurationException { return new StylesheetHandler(this); }
/** * Given a namespace, get the corrisponding prefix. This is here only * to support the {@link org.apache.xml.utils.PrefixResolver} interface, * and will throw an error if invoked on this object. * * @param prefix The prefix to look up, which may be an empty string ("") for the default Namespace. * @param context The node context from which to look up the URI. * * @return The associated Namespace URI, or null if the prefix * is undeclared in this context. */ public String getNamespaceForPrefix(String prefix, org.w3c.dom.Node context) { // Don't need to support this here. Return the current URI for the prefix, // ignoring the context. assertion(true, "can't process a context node in StylesheetHandler!"); return null; }
throws org.xml.sax.SAXException NamespaceSupport nssupport = this.getNamespaceSupport(); nssupport.pushContext(); checkForFragmentID(attributes); flushCharacters(); pushSpaceHandling(attributes); XSLTElementProcessor elemProcessor = getProcessorFor(uri, localName, rawName); this.pushProcessor(elemProcessor); elemProcessor.startElement(this, uri, localName, rawName, attributes); popSpaceHandling();
/** * Receive notification of the end of an element. * * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @see org.xml.sax.ContentHandler#endElement * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public void endElement(String uri, String localName, String rawName) throws org.xml.sax.SAXException { m_elementID--; if (!m_shouldProcess) return; if ((m_elementID + 1) == m_fragmentID) m_shouldProcess = false; flushCharacters(); popSpaceHandling(); XSLTElementProcessor p = getCurrentProcessor(); p.endElement(this, uri, localName, rawName); this.popProcessor(); this.getNamespaceSupport().popContext(); }
/** * Append the current template element to the current * template element, and then push it onto the current template * element stack. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param elem non-null reference to a the current template element. * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ protected void appendAndPush( StylesheetHandler handler, ElemTemplateElement elem) throws org.xml.sax.SAXException { ElemTemplateElement parent = handler.getElemTemplateElement(); if(null != parent) // defensive, for better multiple error reporting. -sb { parent.appendChild(elem); handler.pushElemTemplateElement(elem); } }
m_outputProperties.setDOMBackPointer(handler.getOriginatingNode()); m_outputProperties.setLocaterInfo(handler.getLocator()); m_outputProperties.setUid(handler.nextUid()); setPropertiesFromAttributes(handler, rawName, attributes, this); handler.getBaseIdentifier()); m_outputProperties.getProperties().put(OutputPropertiesFactory.S_KEY_ENTITIES, absURL); handler.error(te.getMessage(), te); handler.getStylesheet().setOutput(m_outputProperties); ElemTemplateElement parent = handler.getElemTemplateElement(); parent.appendChild(m_outputProperties);
throws org.xml.sax.SAXException TransformerFactoryImpl processor = handler.getStylesheetProcessor(); URIResolver uriresolver = processor.getURIResolver(); source = handler.peekSourceFromURIResolver(); String systemId = handler.peekImportURL(); handler.pushBaseIndentifier(systemId); handler.popBaseIndentifier(); return; handler.getBaseIdentifier()); factory.setNamespaceAware( true ); if (handler.getStylesheetProcessor().isSecureProcessing()) handler.pushBaseIndentifier(inputSource.getSystemId()); handler.popBaseIndentifier(); handler.error(XSLTErrorResources.ER_IOEXCEPTION, new Object[]{ getHref() }, ioe); handler.error(te.getMessage(), te);
if(colon>=0) ns=getNamespaceForPrefix(prefix=target.substring(0,colon)); localName=target.substring(colon+1); throw new TransformerException ("xalan:doc-cache-off not allowed here!", getLocator()); ElemForEach elem = (ElemForEach)m_elems.peek(); flushCharacters(); getCurrentProcessor().processingInstruction(this, target, data);
/** * Append the current template element to the current * template element, and then push it onto the current template * element stack. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param elem non-null reference to a {@link org.apache.xalan.templates.ElemText}. * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ protected void appendAndPush( StylesheetHandler handler, ElemTemplateElement elem) throws org.xml.sax.SAXException { // Don't push this element onto the element stack. ProcessorCharacters charProcessor = (ProcessorCharacters) handler.getProcessorFor(null, "text()", "text"); charProcessor.setXslTextElement((ElemText) elem); ElemTemplateElement parent = handler.getElemTemplateElement(); parent.appendChild(elem); elem.setDOMBackPointer(handler.getOriginatingNode()); }
/** * Receive notification of the end of an element. * * @param name The element type name. * @param attributes The specified or defaulted attributes. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). */ public void endElement( StylesheetHandler handler, String uri, String localName, String rawName) throws org.xml.sax.SAXException { ElemVariable v = (ElemVariable) handler.getElemTemplateElement(); handler.getStylesheet().appendChild(v); handler.getStylesheet().setVariable(v); super.endElement(handler, uri, localName, rawName); } }
XPath pattern = handler.createMatchPatternXPath(value, owner);
/** * Flush the characters buffer. * * @throws org.xml.sax.SAXException */ private void flushCharacters() throws org.xml.sax.SAXException { XSLTElementProcessor elemProcessor = getCurrentProcessor(); if (null != elemProcessor) elemProcessor.startNonText(this); }
XPath expr = handler.createXPath(value, owner);
/** * Get the Source object for the included or imported stylesheet module * obtained from the user's URIResolver, if there is no user provided * URIResolver null is returned. */ private Source getSourceFromUriResolver(StylesheetHandler handler) throws TransformerException { Source s = null; TransformerFactoryImpl processor = handler.getStylesheetProcessor(); URIResolver uriresolver = processor.getURIResolver(); if (uriresolver != null) { String href = getHref(); String base = handler.getBaseIdentifier(); s = uriresolver.resolve(href,base); } return s; }
/** * Receive notification of the end of an element. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). */ public void endElement( StylesheetHandler handler, String uri, String localName, String rawName) throws org.xml.sax.SAXException { ElemTemplateElement elem = handler.getElemTemplateElement(); if (elem instanceof ElemLiteralResult) { if (((ElemLiteralResult) elem).getIsLiteralResultAsStylesheet()) { handler.popStylesheet(); } } super.endElement(handler, uri, localName, rawName); }
if (!(handler.getElemTemplateElement() instanceof Stylesheet)) handler.error(msg, new SAXException(msg)); handler.error(msg, new SAXException(msg));
handler.createXPath(exprBuffer.toString(), owner); handler.warn(XSLTErrorResources.WG_FOUND_CURLYBRACE, null); //"Found \"}\" but no attribute template open!"); handler.warn(XSLTErrorResources.WG_ATTR_TEMPLATE, new Object[]{ error }); //"Attr Template, "+error);
/** * Receive notification of character data inside an element. * * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param ch The characters. * @param start The start position in the character array. * @param length The number of characters to use from the * character array. */ public void characters( StylesheetHandler handler, char ch[], int start, int length) throws org.xml.sax.SAXException { handler.error(XSLTErrorResources.ER_CHARS_NOT_ALLOWED, null, null);//"Characters are not allowed at this point in the document!", //null); }
return; XSLTElementProcessor elemProcessor = getCurrentProcessor(); XSLTElementDef def = elemProcessor.getElemDef(); error(