/** * Get the line number of the expression within its containing entity * Returns -1 if no line number is available */ public int getLineNumber() { return element.getLineNumber(); }
/** * Get the line number of the expression within its containing entity * Returns -1 if no line number is available */ public int getLineNumber() { return element.getLineNumber(); }
public int getLineNumber(long locationId) { return getLineNumber(); }
public int getLineNumber(long locationId) { return getLineNumber(); }
/** * Make an attribute value template in the context of this stylesheet element * @param expression the source text of the attribute value template * @return a compiled XPath expression that computes the value of the attribute (including * concatenating the results of embedded expressions with any surrounding fixed text) */ protected Expression makeAttributeValueTemplate(String expression) throws XPathException { try { return AttributeValueTemplate.make(expression, getLineNumber(), staticContext); } catch (XPathException err) { compileError(err); return new StringLiteral(expression); } }
/** * Make an attribute value template in the context of this stylesheet element * @param expression the source text of the attribute value template * @return a compiled XPath expression that computes the value of the attribute (including * concatenating the results of embedded expressions with any surrounding fixed text) */ protected Expression makeAttributeValueTemplate(String expression) throws XPathException { try { return AttributeValueTemplate.make(expression, getLineNumber(), staticContext); } catch (XPathException err) { compileError(err); return new StringLiteral(expression); } }
/** * Create a trace instruction to wrap a real instruction * @param source the parent element * @param child the compiled expression tree for the instruction to be traced * @return a wrapper instruction that performs the tracing (if activated at run-time) */ protected static TraceWrapper makeTraceInstruction(StyleElement source, Expression child) { if (child instanceof TraceWrapper) { return (TraceWrapper)child; // this can happen, for example, after optimizing a compile-time xsl:if } TraceWrapper trace = new TraceInstruction(child, source); trace.setLocationId(source.allocateLocationId(source.getSystemId(), source.getLineNumber())); trace.setContainer(source); return trace; }
/** * Create a trace instruction to wrap a real instruction * @param source the parent element * @param child the compiled expression tree for the instruction to be traced * @return a wrapper instruction that performs the tracing (if activated at run-time) */ protected static TraceWrapper makeTraceInstruction(StyleElement source, Expression child) { if (child instanceof TraceWrapper) { return (TraceWrapper)child; // this can happen, for example, after optimizing a compile-time xsl:if } TraceWrapper trace = new TraceInstruction(child, source); trace.setLocationId(source.allocateLocationId(source.getSystemId(), source.getLineNumber())); trace.setContainer(source); return trace; }
/** * Compile an XPath expression in the context of this stylesheet element * @param expression the source text of the XPath expression * @return the compiled expression tree for the XPath expression */ public Expression makeExpression(String expression) throws XPathException { try { return ExpressionTool.make(expression, staticContext, 0, Token.EOF, getLineNumber(), getPreparedStylesheet().isCompileWithTracing()); } catch (XPathException err) { err.setLocator(this); compileError(err); ErrorExpression erexp = new ErrorExpression(err); erexp.setLocationId(allocateLocationId(getSystemId(), getLineNumber())); erexp.setContainer(this); return erexp; } }
/** * Compile an XPath expression in the context of this stylesheet element * @param expression the source text of the XPath expression * @return the compiled expression tree for the XPath expression */ public Expression makeExpression(String expression) throws XPathException { try { return ExpressionTool.make(expression, staticContext, 0, Token.EOF, getLineNumber(), getPreparedStylesheet().isCompileWithTracing()); } catch (XPathException err) { err.setLocator(this); compileError(err); ErrorExpression erexp = new ErrorExpression(err); erexp.setLocationId(allocateLocationId(getSystemId(), getLineNumber())); erexp.setContainer(this); return erexp; } }
if (thisPrecedence == otherPrecedence) { sourceFunction.compileError("Duplicate named function (see line " + otherFunction.getSourceElement().getLineNumber() + " of " + otherFunction.getSourceElement().getSystemId() + ')', "XTSE0770"); } else if (thisPrecedence < otherPrecedence) {
if (thisPrecedence == otherPrecedence) { sourceFunction.compileError("Duplicate named function (see line " + otherFunction.getSourceElement().getLineNumber() + " of " + otherFunction.getSourceElement().getSystemId() + ')', "XTSE0770"); } else if (thisPrecedence < otherPrecedence) {
/** * Static factory method to make a Pattern by parsing a String. <br> * * @param pattern The pattern text as a String * @param env An object defining the compile-time context for the expression * @param packageData The package containing this pattern * @return The pattern object * @throws net.sf.saxon.trans.XPathException if the pattern is invalid */ public static Pattern make(String pattern, StaticContext env, PackageData packageData) throws XPathException { int languageLevel = env.getConfiguration().getConfigurationProperty(Feature.XPATH_VERSION_FOR_XSLT); if (languageLevel == 30) { languageLevel = 305; // XPath 3.0 + XSLT extensions } int lineNumber = env instanceof ExpressionContext ? ((ExpressionContext) env).getStyleElement().getLineNumber() : -1; PatternParser parser = (PatternParser) env.getConfiguration().newExpressionParser("PATTERN", false, languageLevel); ((XPathParser) parser).setLanguage(XPathParser.XSLT_PATTERN, 30); Pattern pat = parser.parsePattern(pattern, env); pat.setRetainedStaticContext(env.makeRetainedStaticContext()); // System.err.println("Simplified [" + pattern + "] to " + pat.getClass() + " default prio = " + pat.getDefaultPriority()); pat = pat.simplify(); return pat; }
/** * Static factory method to make a Pattern by parsing a String. <br> * * @param pattern The pattern text as a String * @param env An object defining the compile-time context for the expression * @param packageData The package containing this pattern * @return The pattern object * @throws net.sf.saxon.trans.XPathException if the pattern is invalid */ public static Pattern make(String pattern, StaticContext env, PackageData packageData) throws XPathException { int languageLevel = env.getConfiguration().getConfigurationProperty(Feature.XPATH_VERSION_FOR_XSLT); if (languageLevel == 30) { languageLevel = 305; // XPath 3.0 + XSLT extensions } int lineNumber = env instanceof ExpressionContext ? ((ExpressionContext) env).getStyleElement().getLineNumber() : -1; PatternParser parser = (PatternParser) env.getConfiguration().newExpressionParser("PATTERN", false, languageLevel); ((XPathParser) parser).setLanguage(XPathParser.XSLT_PATTERN, 30); Pattern pat = parser.parsePattern(pattern, env); pat.setRetainedStaticContext(env.makeRetainedStaticContext()); // System.err.println("Simplified [" + pattern + "] to " + pat.getClass() + " default prio = " + pat.getDefaultPriority()); pat = pat.simplify(); return pat; }
InstructionDetails details = new InstructionDetails(); details.setConstructType(Location.XPATH_IN_XSLT); details.setLineNumber(getLineNumber()); details.setSystemId(getSystemId()); details.setProperty("attribute-name", name); TraceWrapper trace = new TraceInstruction(exp, details); trace.setLocationId(allocateLocationId(getSystemId(), getLineNumber())); trace.setContainer(this); exp = trace; } else { ErrorExpression erexp = new ErrorExpression(err); erexp.setLocationId(allocateLocationId(getSystemId(), getLineNumber())); return erexp;
InstructionDetails details = new InstructionDetails(); details.setConstructType(Location.XPATH_IN_XSLT); details.setLineNumber(getLineNumber()); details.setSystemId(getSystemId()); details.setProperty("attribute-name", name); TraceWrapper trace = new TraceInstruction(exp, details); trace.setLocationId(allocateLocationId(getSystemId(), getLineNumber())); trace.setContainer(this); exp = trace; } else { ErrorExpression erexp = new ErrorExpression(err); erexp.setLocationId(allocateLocationId(getSystemId(), getLineNumber())); return erexp;
String errorCode = sourceTemplate.getParent() instanceof XSLOverride ? "XTSE3055" : "XTSE0660"; sourceTemplate.compileError("Duplicate named template (see line " + otherTemplate.getSourceElement().getLineNumber() + " of " + otherTemplate.getSourceElement().getSystemId() + ')', errorCode); } else if (thisPrecedence < otherPrecedence) {
String errorCode = sourceTemplate.getParent() instanceof XSLOverride ? "XTSE3055" : "XTSE0660"; sourceTemplate.compileError("Duplicate named template (see line " + otherTemplate.getSourceElement().getLineNumber() + " of " + otherTemplate.getSourceElement().getSystemId() + ')', errorCode); } else if (thisPrecedence < otherPrecedence) {
fallback = Block.makeBlock(fallback, b); fallback.setLocationId( allocateLocationId(getSystemId(), getLineNumber()));
fallback = Block.makeBlock(fallback, b); fallback.setLocationId( allocateLocationId(getSystemId(), getLineNumber()));