本文整理汇总了Java中org.apache.xalan.templates.ElemTemplateElement类的典型用法代码示例。如果您正苦于以下问题:Java ElemTemplateElement类的具体用法?Java ElemTemplateElement怎么用?Java ElemTemplateElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ElemTemplateElement类属于org.apache.xalan.templates包,在下文中一共展示了ElemTemplateElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ancestorIsOk
import org.apache.xalan.templates.ElemTemplateElement; //导入依赖的package包/类
/**
* Verify that a literal result belongs to a result element, a variable,
* or a parameter.
*/
boolean ancestorIsOk(ElemTemplateElement child)
{
while (child.getParentElem() != null && !(child.getParentElem() instanceof ElemExsltFunction))
{
ElemTemplateElement parent = child.getParentElem();
if (parent instanceof ElemExsltFuncResult
|| parent instanceof ElemVariable
|| parent instanceof ElemParam
|| parent instanceof ElemMessage)
return true;
child = parent;
}
return false;
}
示例2: getElemVersion
import org.apache.xalan.templates.ElemTemplateElement; //导入依赖的package包/类
private double getElemVersion()
{
ElemTemplateElement elem = getElemTemplateElement();
double version = -1;
while ((version == -1 || version == Constants.XSLTVERSUPPORTED) && elem != null)
{
try{
version = Double.valueOf(elem.getXmlVersion()).doubleValue();
}
catch (Exception ex)
{
version = -1;
}
elem = elem.getParentElem();
}
return (version == -1)? Constants.XSLTVERSUPPORTED : version;
}
示例3: startElement
import org.apache.xalan.templates.ElemTemplateElement; //导入依赖的package包/类
/**
* Verify that the func:result element does not appear within a variable,
* parameter, or another func:result, and that it belongs to a func:function
* element.
*/
public void startElement(
StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes)
throws SAXException
{
String msg = "";
super.startElement(handler, uri, localName, rawName, attributes);
ElemTemplateElement ancestor = handler.getElemTemplateElement().getParentElem();
while (ancestor != null && !(ancestor instanceof ElemExsltFunction))
{
if (ancestor instanceof ElemVariable
|| ancestor instanceof ElemParam
|| ancestor instanceof ElemExsltFuncResult)
{
msg = "func:result cannot appear within a variable, parameter, or another func:result.";
handler.error(msg, new SAXException(msg));
}
ancestor = ancestor.getParentElem();
}
if (ancestor == null)
{
msg = "func:result must appear in a func:function element";
handler.error(msg, new SAXException(msg));
}
}
示例4: appendAndPush
import org.apache.xalan.templates.ElemTemplateElement; //导入依赖的package包/类
/**
* 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());
}
示例5: processAVT
import org.apache.xalan.templates.ElemTemplateElement; //导入依赖的package包/类
/**
* Process an attribute string of type T_AVT into
* a AVT value.
*
* @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
* @param uri The Namespace URI, or an empty string.
* @param name The local name (without prefix), or empty string if not namespace processing.
* @param rawName The qualified name (with prefix).
* @param value Should be an Attribute Value Template string.
*
* @return An AVT object that may be used to evaluate the Attribute Value Template.
*
* @throws org.xml.sax.SAXException which will wrap a
* {@link javax.xml.transform.TransformerException}, if there is a syntax error
* in the attribute value template string.
*/
AVT processAVT(
StylesheetHandler handler, String uri, String name, String rawName, String value,
ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
try
{
AVT avt = new AVT(handler, uri, name, rawName, value, owner);
return avt;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
}
示例6: processCDATA
import org.apache.xalan.templates.ElemTemplateElement; //导入依赖的package包/类
/**
* Process an attribute string of type T_CDATA into
* a String value.
*
* @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
* @param uri The Namespace URI, or an empty string.
* @param name The local name (without prefix), or empty string if not namespace processing.
* @param rawName The qualified name (with prefix).
* @param value non-null string reference.
*
* @return The value argument.
*
* @throws org.xml.sax.SAXException.
*/
Object processCDATA(StylesheetHandler handler, String uri, String name,
String rawName, String value, ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
if (getSupportsAVT()) {
try
{
AVT avt = new AVT(handler, uri, name, rawName, value, owner);
return avt;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
} else {
return value;
}
}
示例7: processEXPR
import org.apache.xalan.templates.ElemTemplateElement; //导入依赖的package包/类
/**
* Process an attribute string of type T_EXPR into
* an XPath value.
*
* @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
* @param uri The Namespace URI, or an empty string.
* @param name The local name (without prefix), or empty string if not namespace processing.
* @param rawName The qualified name (with prefix).
* @param value An XSLT expression string.
*
* @return an XPath object that may be used for evaluation.
*
* @throws org.xml.sax.SAXException that wraps a
* {@link javax.xml.transform.TransformerException} if the expression
* string contains a syntax error.
*/
Object processEXPR(
StylesheetHandler handler, String uri, String name, String rawName, String value,
ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
try
{
XPath expr = handler.createXPath(value, owner);
return expr;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
}
示例8: processPATTERN
import org.apache.xalan.templates.ElemTemplateElement; //导入依赖的package包/类
/**
* Process an attribute string of type T_PATTERN into
* an XPath match pattern value.
*
* @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
* @param uri The Namespace URI, or an empty string.
* @param name The local name (without prefix), or empty string if not namespace processing.
* @param rawName The qualified name (with prefix).
* @param value A match pattern string.
*
* @return An XPath pattern that may be used to evaluate the XPath.
*
* @throws org.xml.sax.SAXException that wraps a
* {@link javax.xml.transform.TransformerException} if the match pattern
* string contains a syntax error.
*/
Object processPATTERN(
StylesheetHandler handler, String uri, String name, String rawName, String value,
ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
try
{
XPath pattern = handler.createMatchPatternXPath(value, owner);
return pattern;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
}
示例9: processQNAME
import org.apache.xalan.templates.ElemTemplateElement; //导入依赖的package包/类
/**
* Process an attribute string of type T_QNAME into a QName value.
*
* @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
* @param uri The Namespace URI, or an empty string.
* @param name The local name (without prefix), or empty string if not namespace processing.
* @param rawName The qualified name (with prefix).
* @param value A string that represents a potentially prefix qualified name.
* @param owner
*
* @return A QName object if this attribute does not support AVT's. Otherwise, an AVT
* is returned.
*
* @throws org.xml.sax.SAXException if the string contains a prefix that can not be
* resolved, or the string contains syntax that is invalid for a qualified name.
*/
Object processQNAME(
StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
try
{
QName qname = new QName(value, handler, true);
return qname;
}
catch (IllegalArgumentException ie)
{
// thrown by QName constructor
handleError(handler,XSLTErrorResources.INVALID_QNAME, new Object[] {name, value},ie);
return null;
}
catch (RuntimeException re) {
// thrown by QName constructor
handleError(handler,XSLTErrorResources.INVALID_QNAME, new Object[] {name, value},re);
return null;
}
}
示例10: endElement
import org.apache.xalan.templates.ElemTemplateElement; //导入依赖的package包/类
/**
* 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);
}
示例11: executeChildTemplates
import org.apache.xalan.templates.ElemTemplateElement; //导入依赖的package包/类
/**
* Execute each of the children of a template element. This method
* is only for extension use.
*
* @param elem The ElemTemplateElement that contains the children
* that should execute.
* NEEDSDOC @param context
* @param mode The current mode.
* @param handler The ContentHandler to where the result events
* should be fed.
*
* @throws TransformerException
* @xsl.usage advanced
*/
public void executeChildTemplates(
ElemTemplateElement elem, org.w3c.dom.Node context, QName mode, ContentHandler handler)
throws TransformerException
{
XPathContext xctxt = m_xcontext;
try
{
if(null != mode)
pushMode(mode);
xctxt.pushCurrentNode(xctxt.getDTMHandleFromNode(context));
executeChildTemplates(elem, handler);
}
finally
{
xctxt.popCurrentNode();
// I'm not sure where or why this was here. It is clearly in
// error though, without a corresponding pushMode().
if (null != mode)
popMode();
}
}
示例12: getInstruction
import org.apache.xalan.templates.ElemTemplateElement; //导入依赖的package包/类
static String getInstruction(ElemTemplateElement node) {
final String name = node.getNodeName();
if (node instanceof ElemLiteralResult) {
return name;
} else if (name != null && name.indexOf(':') == -1) {
return "xsl:" + name;
}
return name;
}
示例13: appendAndPush
import org.apache.xalan.templates.ElemTemplateElement; //导入依赖的package包/类
/**
* Must include; super doesn't suffice!
*/
protected void appendAndPush(
StylesheetHandler handler, ElemTemplateElement elem)
throws SAXException
{
//System.out.println("ProcessorFunction appendAndPush()" + elem);
super.appendAndPush(handler, elem);
//System.out.println("originating node " + handler.getOriginatingNode());
elem.setDOMBackPointer(handler.getOriginatingNode());
handler.getStylesheet().setTemplate((ElemTemplate) elem);
}
示例14: endElement
import org.apache.xalan.templates.ElemTemplateElement; //导入依赖的package包/类
/**
* End an ElemExsltFunction, and verify its validity.
*/
public void endElement(
StylesheetHandler handler, String uri, String localName, String rawName)
throws SAXException
{
ElemTemplateElement function = handler.getElemTemplateElement();
validate(function, handler); // may throw exception
super.endElement(handler, uri, localName, rawName);
}
示例15: createMatchPatternXPath
import org.apache.xalan.templates.ElemTemplateElement; //导入依赖的package包/类
/**
* Process an expression string into an XPath.
*
* @param str A non-null reference to a valid or invalid match pattern string.
*
* @return A non-null reference to an XPath object that represents the string argument.
*
* @throws javax.xml.transform.TransformerException if the pattern can not be processed.
* @see <a href="http://www.w3.org/TR/xslt#patterns">Section 5.2 Patterns in XSLT Specification</a>
*/
XPath createMatchPatternXPath(String str, ElemTemplateElement owningTemplate)
throws javax.xml.transform.TransformerException
{
ErrorListener handler = m_stylesheetProcessor.getErrorListener();
XPath xpath = new XPath(str, owningTemplate, this, XPath.MATCH, handler,
m_funcTable);
// Visit the expression, registering namespaces for any extension functions it includes.
xpath.callVisitors(xpath, new ExpressionVisitor(getStylesheetRoot()));
return xpath;
}