m_defaultRule = new ElemTemplate(); m_defaultRule.setStylesheet(this); m_defaultRule.setMatch(defMatch); m_defaultRule.appendChild(childrenElement); m_defaultTextRule = new ElemTemplate(); m_defaultTextRule.setStylesheet(this); m_defaultTextRule.setMatch(defMatch); m_defaultTextRule.appendChild(elemValueOf); m_defaultRootRule = new ElemTemplate(); m_defaultRootRule.setStylesheet(this); m_defaultRootRule.setMatch(defMatch); m_defaultRootRule.appendChild(childrenElement); childrenElement.setSelect(m_selectDefault);
/** * Called after everything else has been * recomposed, and allows the function to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); // Register the function namespace (if not already registered). String namespace = getName().getNamespace(); String handlerClass = sroot.getExtensionHandlerClass(); Object[] args ={namespace, sroot}; ExtensionNamespaceSupport extNsSpt = new ExtensionNamespaceSupport(namespace, handlerClass, args); sroot.getExtensionNamespacesManager().registerExtension(extNsSpt); // Make sure there is a handler for the EXSLT functions namespace // -- for isElementAvailable(). if (!(namespace.equals(Constants.S_EXSLT_FUNCTIONS_URL))) { namespace = Constants.S_EXSLT_FUNCTIONS_URL; args = new Object[]{namespace, sroot}; extNsSpt = new ExtensionNamespaceSupport(namespace, handlerClass, args); sroot.getExtensionNamespacesManager().registerExtension(extNsSpt); } } }
XPath matchXPath = template.getMatch(); if (null == template.getName() && null == matchXPath) template.error(XSLTErrorResources.ER_NEED_NAME_OR_MATCH_ATTRIB, new Object[]{ "xsl:template" }); if (null != template.getName()) ElemTemplate existingTemplate = (ElemTemplate) m_namedTemplates.get(template.getName()); if (null == existingTemplate) m_namedTemplates.put(template.getName(), template); existingTemplate.getStylesheetComposed().getImportCountComposed(); int newPrecedence = template.getStylesheetComposed().getImportCountComposed(); if (newPrecedence > existingPrecedence) m_namedTemplates.put(template.getName(), template); template.error(XSLTErrorResources.ER_DUPLICATE_NAMED_TEMPLATE, new Object[]{ template.getName() });
m_pw.print(et.getSystemId()+ " Line #" + et.getLineNumber() + ", " + "Column #" + et.getColumnNumber() + ": " + et.getNodeName() + " "); if (null != et.getMatch()) m_pw.print("match='" + et.getMatch().getPatternString() + "' "); if (null != et.getName()) m_pw.print("name='" + et.getName() + "' ");
ElemTemplate template = new ElemTemplate(); if (slocator != null) template.setLocaterInfo(slocator); handler.getStylesheetProcessor().getErrorListener()); template.setMatch(rootMatch);
m_defaultRule = new ElemTemplate(); m_defaultRule.setStylesheet(this); m_defaultRule.setMatch(defMatch); m_defaultTextRule = new ElemTemplate(); m_defaultTextRule.setStylesheet(this); m_defaultTextRule.setMatch(defMatch); m_defaultRootRule = new ElemTemplate(); m_defaultRootRule.setStylesheet(this); m_defaultRootRule.setMatch(defMatch);
String idIs = XSLMessages.createMessage(((null != template.getName()) ? "nameIs" : "matchPatternIs"), null); Object[] msgArgs = new Object[]{ new Integer(loopCount), idIs, ((null != template.getName()) ? template.getName().toString() : template.getMatch().getPatternString()) }; String msg = XSLMessages.createMessage("recursionTooDeep", msgArgs);
m_pw.print(et.getSystemId()+ " Line #" + et.getLineNumber() + ", " + "Column #" + et.getColumnNumber() + ": " + et.getNodeName() + " "); if (null != et.getMatch()) m_pw.print("match='" + et.getMatch().getPatternString() + "' "); if (null != et.getName()) m_pw.print("name='" + et.getName() + "' ");
/** * Tell if two modes match according to the rules of XSLT. * * @param m1 mode to match * * @return True if the given mode matches this template's mode */ boolean matchMode(QName m1) { return matchModes(m1, m_template.getMode()); }
/** * Given a match pattern and template association, return the * score of that match. This score or priority can always be * statically calculated. * * @param matchPat The match pattern to template association. * * @return {@link org.apache.xpath.patterns.NodeTest#SCORE_NODETEST}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NONE}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NSWILD}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or * {@link org.apache.xpath.patterns.NodeTest#SCORE_OTHER}, or * the value defined by the priority attribute of the template. * */ private double getPriorityOrScore(TemplateSubPatternAssociation matchPat) { double priority = matchPat.getTemplate().getPriority(); if (priority == XPath.MATCH_SCORE_NONE) { Expression ex = matchPat.getStepPattern(); if (ex instanceof NodeTest) { return ((NodeTest) ex).getDefaultScore(); } } return priority; }
m_template.execute(transformer);
/** * Return the import level associated with the stylesheet into which * this template is composed. * * @return The import level of this template. */ public final int getImportLevel() { return m_template.getStylesheetComposed().getImportCountComposed(); }
String pstring = template.getMatch().getPatternString(); TemplateSubPatternAssociation association = new TemplateSubPatternAssociation(template, pattern, pstring);
/** * Constructor WhiteSpaceInfo * * * @param matchPattern Match pattern * @param shouldStripSpace Flag indicating whether or not * to strip whitespaces * @param thisSheet The current stylesheet */ public WhiteSpaceInfo(XPath matchPattern, boolean shouldStripSpace, Stylesheet thisSheet) { m_shouldStripSpace = shouldStripSpace; setMatch(matchPattern); setStylesheet(thisSheet); }
/** * Called after everything else has been * recomposed, and allows the function to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); // Register the function namespace (if not already registered). String namespace = getName().getNamespace(); String handlerClass = sroot.getExtensionHandlerClass(); Object[] args ={namespace, sroot}; ExtensionNamespaceSupport extNsSpt = new ExtensionNamespaceSupport(namespace, handlerClass, args); sroot.getExtensionNamespacesManager().registerExtension(extNsSpt); // Make sure there is a handler for the EXSLT functions namespace // -- for isElementAvailable(). if (!(namespace.equals(Constants.S_EXSLT_FUNCTIONS_URL))) { namespace = Constants.S_EXSLT_FUNCTIONS_URL; args = new Object[]{namespace, sroot}; extNsSpt = new ExtensionNamespaceSupport(namespace, handlerClass, args); sroot.getExtensionNamespacesManager().registerExtension(extNsSpt); } } }
ElemTemplate template = new ElemTemplate(); if (slocator != null) template.setLocaterInfo(slocator); handler.getStylesheetProcessor().getErrorListener()); template.setMatch(rootMatch);
m_pw.print(et.getSystemId()+ " Line #" + et.getLineNumber() + ", " + "Column #" + et.getColumnNumber() + ": " + et.getNodeName() + " "); if (null != et.getMatch()) m_pw.print("match='" + et.getMatch().getPatternString() + "' "); if (null != et.getName()) m_pw.print("name='" + et.getName() + "' ");
m_defaultRule = new ElemTemplate(); m_defaultRule.setStylesheet(this); m_defaultRule.setMatch(defMatch); m_defaultTextRule = new ElemTemplate(); m_defaultTextRule.setStylesheet(this); m_defaultTextRule.setMatch(defMatch); m_defaultRootRule = new ElemTemplate(); m_defaultRootRule.setStylesheet(this); m_defaultRootRule.setMatch(defMatch);
String idIs = XSLMessages.createMessage(((null != template.getName()) ? "nameIs" : "matchPatternIs"), null); Object[] msgArgs = new Object[]{ new Integer(loopCount), idIs, ((null != template.getName()) ? template.getName().toString() : template.getMatch().getPatternString()) }; String msg = XSLMessages.createMessage("recursionTooDeep", msgArgs);
m_pw.print(et.getSystemId()+ " Line #" + et.getLineNumber() + ", " + "Column #" + et.getColumnNumber() + ": " + et.getNodeName() + " "); if (null != et.getMatch()) m_pw.print("match='" + et.getMatch().getPatternString() + "' "); if (null != et.getName()) m_pw.print("name='" + et.getName() + "' ");