This message:
 
Supplied node must be built using the same or a compatible Configuration
 
shows that you have more than one Configuration object around, so perhaps you are setting the attribute on the wrong one.
 
If you use multiple JAXP factories and share nodes between them, then you must make sure they all use the same underlying Saxon Configuration. (Frankly, if you're trying to do this kind of thing, it's much cleaner to forget JAXP interfaces and use s9api instead).
 
As an alternative to setting optimization level to zero, try using a variable that won't be inlined, for example because there are multiple references to it. And try doing the equivalent of -explain to view the optimized code before you trace it (from the API, you can use the ExpressionPresenter to display a compiled expression).
 

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay



From: Alexandre Brillant [mailto:alex77000@gmail.com]
Sent: 12 February 2010 15:30
To: Mailing list for the SAXON XSLT and XQuery processor
Subject: Re: [saxon] Problem for tracing variables and parameters in saxon 9

tFactory.setAttribute( FeatureKeys.OPTIMIZATION_LEVEL, new Integer( 0 ) );
It seems it has no effect, can't see any changes, the list is always empty.

I try also to force myself an XPath evaluation :

XPathContext xc...
SequenceIterator it = xc.getCurrentIterator();
Item current = it.current();
net.sf.saxon.xpath.XPathEvaluator.XPathEvaluator xp = new net.sf.saxon.xpath.XPathEvaluator.XPathEvaluator();
String test = xp.evaluate( ".", current );

But I receive the following exception

javax.xml.xpath.XPathExpressionException: Supplied node must be built using the same or a compatible Configuration
at net.sf.saxon.xpath.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:283)
at net.sf.saxon.xpath.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:375)
at net.sf.saxon.xpath.XPathEvaluator.evaluate(XPathEvaluator.java:474)

What kind of node should be used for evaluating ?


On Fri, Feb 12, 2010 at 3:36 PM, Michael Kay <mike@saxonica.com> wrote:
There's an option -opt that sets the optimization level from the command line, or the equivalent in the Configuration API is FeatureKeys.OPTIMIZATION_LEVEL

From: Alexandre Brillant [mailto:alex77000@gmail.com]
Sent: 12 February 2010 14:30
To: Mailing list for the SAXON XSLT and XQuery processor
Subject: Re: [saxon] Problem for tracing variables and parameters in saxon 9

Thank you Michael, but what do you mean by setting "opt:0" ?

On Fri, Feb 12, 2010 at 3:24 PM, Michael Kay <mike@saxonica.com> wrote:
In this example, there is only one reference to the variable, so the optimizer will have inlined it: the variable will not actually exist at run-time.
 
You could try setting opt:0 to disable optimization (this won't actually disable all optimizations, but I think it should work for this one).
 
The -explain flag should help you understand what the optimized code looks like.
 
The other thing to be aware of is that (regardless of optimization) variables may be lazily evaluated - the variable is not evaluated when it is declared, but when it is first referenced.
 


From: Alexandre Brillant [mailto:alex77000@gmail.com]
Sent: 12 February 2010 13:56
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Problem for tracing variables and parameters in saxon 9

Hello,

I try to trace the variables and the parameters when running and the bound values.

Here my XSLT sample, the variable name should be traced

<xsl:stylesheet version="2.0" 
exclude-result-prefixes="xs xdt err fn">

<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="person">
<xsl:variable name="name" select="name/family"/>
<h1><xsl:value-of select="concat($name,'test')"/></h1>
</xsl:template>

</xsl:stylesheet>

In my code, I used the TraceListener

public void enter(InstructionInfo arg0, XPathContext xc ) {

  StackFrame stackFrame = xc.getStackFrame(); List variables = stackFrame.getStackFrameMap().getVariableMap();   
System.out.println( variables );

}

The problem is that the variables list is always empty ? How can I get the list of variables and parameters ?

Thank you for your help, 

Best regards,

A.Rickard

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/saxon-help