You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by Colin Paul Adams <co...@colina.demon.co.uk> on 2003/03/05 07:12:16 UTC
function-available not working
Well, it seems my problems with EXSLT were nothing of the kind.
The following transform does not produce any output (messages or a
document element) at all:
<?xml version='1.0'?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:test="urn:colina.demon.co.uk:domwriter-test-one"
xmlns:math="http://exslt.org/math">
<xsl:template match="/">
<xsl:message>
<xsl:text>math:abs to be tested</xsl:text>
</xsl:message>
<xsl:when test="function-available('math:abs')">
<xsl:message>
<xsl:text>math:abs available</xsl:text>
</xsl:message>
<transformed value="{math:abs(-3)}" />
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>math:abs not available</xsl:text>
</xsl:message>
<nottransformed />
</xsl:otherwise>
</xsl:template>
</xsl:transform>
Is this a bug, or have I missed something?
(If I remove all the function-avaialble stuff, then it wouks as expected.)
--
Colin Paul Adams
Preston Lancashire
Re: Capturing output (Was: function-available not working)
Posted by David N Bertoni/Cambridge/IBM <da...@us.ibm.com>.
Hi Colin,
It does not matter if you install a ProblemListener or not. If you don't,
a default instance is installed which sends output to stderr.
We may keep the ProblemListener mechanism, but change it slightly. The
issue is that the way it works now is too intrusive. It's designed to
report the error _before_ Xalan deals with it, which means it must be
propagated throughout the system. That's a huge pain, and, as you can see,
there are places where it's not happening. If we keep it, it will probably
be for reporting errors after exceptions have been thrown and caught at the
top-most level.
Dave
Colin Paul Adams
<colin@colina.de To: xalan-c-users@xml.apache.org
mon.co.uk> cc: (bcc: David N Bertoni/Cambridge/IBM)
Subject: Re: Capturing output (Was: function-available not working)
03/05/2003 11:07
PM
>>>>> "David" == David N Bertoni/Cambridge/IBM <da...@us.ibm.com>
writes:
David> Hi Colin,
David> OK, I just realized what's happening -- this is coming from
David> an exception and is not going through the ProblemListener
David> mechanism. This was reported a while back, but it turned
David> out there was no easy solution to problem. This is a
David> general problem and is why the whole ProblemListener
David> mechanism needs to be removed or revised.
I repeat, I had not installed a ProblemListener, so it does not
explain (to me, unless there is some kind of ProblemListener installed
by default) why I did not see the error.
David> So, you probably need to check the error return from
David> XalanTransformer and look at that in the cases where you
David> don't get anything from the ProblemListener mechanism. If
David> it's non-zero, you can get the last error from
David> XalanTransformer::getLastError().
This works, but I would prefer to be able to implement
ProblemListener, or some such mechanism.
--
Colin Paul Adams
Preston Lancashire
Re: Capturing output (Was: function-available not working)
Posted by Colin Paul Adams <co...@colina.demon.co.uk>.
>>>>> "David" == David N Bertoni/Cambridge/IBM <da...@us.ibm.com> writes:
David> Hi Colin,
David> OK, I just realized what's happening -- this is coming from
David> an exception and is not going through the ProblemListener
David> mechanism. This was reported a while back, but it turned
David> out there was no easy solution to problem. This is a
David> general problem and is why the whole ProblemListener
David> mechanism needs to be removed or revised.
I repeat, I had not installed a ProblemListener, so it does not
explain (to me, unless there is some kind of ProblemListener installed
by default) why I did not see the error.
David> So, you probably need to check the error return from
David> XalanTransformer and look at that in the cases where you
David> don't get anything from the ProblemListener mechanism. If
David> it's non-zero, you can get the last error from
David> XalanTransformer::getLastError().
This works, but I would prefer to be able to implement
ProblemListener, or some such mechanism.
--
Colin Paul Adams
Preston Lancashire
Re: Capturing output (Was: function-available not working)
Posted by David N Bertoni/Cambridge/IBM <da...@us.ibm.com>.
Hi Colin,
OK, I just realized what's happening -- this is coming from an exception
and is not going through the ProblemListener mechanism. This was reported
a while back, but it turned out there was no easy solution to problem.
This is a general problem and is why the whole ProblemListener mechanism
needs to be removed or revised.
So, you probably need to check the error return from XalanTransformer and
look at that in the cases where you don't get anything from the
ProblemListener mechanism. If it's non-zero, you can get the last error
from XalanTransformer::getLastError().
Sorry about the confusion here...
Dave
Colin Paul Adams
<colin@colina.de To: xalan-c-users@xml.apache.org
mon.co.uk> cc: (bcc: David N Bertoni/Cambridge/IBM)
Subject: Re: Capturing output (Was: function-available not working)
03/05/2003 09:59
AM
>>>>> "David" == David N Bertoni/Cambridge/IBM <da...@us.ibm.com>
writes:
David> If you're running this from within Eiffel, there may be
David> some issues with stderr, although it would be very strange
I don't think so - the interface with C++ is very clean. And all other
errors from Xerces (I implemented the whole of the DOM) and Xalan appear.
David> to see output from xsl:message and not see an error
David> message. Can you write a quick C++ program to test your
David> C++ interface to Eiffel?
No. At least, not quickly, since there are callback interfaces
involved.
David> And just to be sure, are you working with a CVS drop, or
David> from a particular release?
CVS (I have to use Xercesc 2.2).
--
Colin Paul Adams
Preston Lancashire
Re: Capturing output (Was: function-available not working)
Posted by Colin Paul Adams <co...@colina.demon.co.uk>.
>>>>> "David" == David N Bertoni/Cambridge/IBM <da...@us.ibm.com> writes:
David> If you're running this from within Eiffel, there may be
David> some issues with stderr, although it would be very strange
I don't think so - the interface with C++ is very clean. And all other
errors from Xerces (I implemented the whole of the DOM) and Xalan appear.
David> to see output from xsl:message and not see an error
David> message. Can you write a quick C++ program to test your
David> C++ interface to Eiffel?
No. At least, not quickly, since there are callback interfaces
involved.
David> And just to be sure, are you working with a CVS drop, or
David> from a particular release?
CVS (I have to use Xercesc 2.2).
--
Colin Paul Adams
Preston Lancashire
Re: Capturing output (Was: function-available not working)
Posted by David N Bertoni/Cambridge/IBM <da...@us.ibm.com>.
Hi Colin,
I must have missed your question about the ProblemListener -- I'll go back
and see if I can find it.
If you're running this from within Eiffel, there may be some issues with
stderr, although it would be very strange to see output from xsl:message
and not see an error message. Can you write a quick C++ program to test
your C++ interface to Eiffel?
And just to be sure, are you working with a CVS drop, or from a particular
release?
Dave
Colin Paul Adams
<colin@colina.de To: xalan-c-users@xml.apache.org
mon.co.uk> cc: (bcc: David N Bertoni/Cambridge/IBM)
Subject: Re: Capturing output (Was: function-available not working)
03/05/2003 09:38
AM
>>>>> "David" == David N Bertoni/Cambridge/IBM <da...@us.ibm.com>
writes:
David> Hi Colin,
David> I'm not sure how you're testing, but using the Xalan
David> command line driver, errors, messages, and warnings are all
David> reported to stdout. This is the default, unless you've
David> installed a ProblemListener that does something else. Have
David> you written your own code using XalanTransformer, or are
David> you using the command line utility?
The former (I've actually written an extensive interface for the Eiffel
programming language).
But I haven't installed a ProblemListener, as I am uncertain of the
semantics of the constructor (I posted a question on this subject
earlier this week). So I am surprised not to see the errors.
The transform concerned was a Xerces DOM to Xerces DOM transform, if
it makes any difference.
--
Colin Paul Adams
Preston Lancashire
Re: Capturing output (Was: function-available not working)
Posted by Colin Paul Adams <co...@colina.demon.co.uk>.
>>>>> "David" == David N Bertoni/Cambridge/IBM <da...@us.ibm.com> writes:
David> Hi Colin,
David> I'm not sure how you're testing, but using the Xalan
David> command line driver, errors, messages, and warnings are all
David> reported to stdout. This is the default, unless you've
David> installed a ProblemListener that does something else. Have
David> you written your own code using XalanTransformer, or are
David> you using the command line utility?
The former (I've actually written an extensive interface for the Eiffel
programming language).
But I haven't installed a ProblemListener, as I am uncertain of the
semantics of the constructor (I posted a question on this subject
earlier this week). So I am surprised not to see the errors.
The transform concerned was a Xerces DOM to Xerces DOM transform, if
it makes any difference.
--
Colin Paul Adams
Preston Lancashire
Re: Capturing output (Was: function-available not working)
Posted by David N Bertoni/Cambridge/IBM <da...@us.ibm.com>.
Hi Colin,
I'm not sure how you're testing, but using the Xalan command line driver,
errors, messages, and warnings are all reported to stdout. This is the
default, unless you've installed a ProblemListener that does something
else. Have you written your own code using XalanTransformer, or are you
using the command line utility?
Dave
Colin Paul Adams
<colin@colina.de To: xalan-c-users@xml.apache.org
mon.co.uk> cc: (bcc: David N Bertoni/Cambridge/IBM)
Subject: Capturing output (Was: function-available not working)
03/04/2003 11:47
PM
>>>>> "David" == David N Bertoni/Cambridge/IBM <da...@us.ibm.com>
writes:
David> Hi Colin,
David> When I add the missing xsl:choose, I get the following:
Oh dear - I am really rusty on XSLT -n I must get back to speed soon.
David> way you capture output from the processor, because you
David> missed the error message.
Now this is something that puzzles me. I would have expected to see
the error message on standard error (it is where I see the output from
xsl:message when I eliminate syntax errors).
What parameters affect this?
--
Colin Paul Adams
Preston Lancashire
Capturing output (Was: function-available not working)
Posted by Colin Paul Adams <co...@colina.demon.co.uk>.
>>>>> "David" == David N Bertoni/Cambridge/IBM <da...@us.ibm.com> writes:
David> Hi Colin,
David> When I add the missing xsl:choose, I get the following:
Oh dear - I am really rusty on XSLT -n I must get back to speed soon.
David> way you capture output from the processor, because you
David> missed the error message.
Now this is something that puzzles me. I would have expected to see
the error message on standard error (it is where I see the output from
xsl:message when I eliminate syntax errors).
What parameters affect this?
--
Colin Paul Adams
Preston Lancashire
Re: function-available not working
Posted by David N Bertoni/Cambridge/IBM <da...@us.ibm.com>.
Hi Colin,
Testing with the latest CVS gives the following result:
V:\test\Adams>Xalan test1.xml test1.xsl
XSLT error: xsl:when not parented by xsl:choose. (test1.xsl, line 10,
column 53)
When I add the missing xsl:choose, I get the following:
V:\test\Adams>Xalan test1.xml test1.xsl
XSLT message: math:abs to be tested, source tree node: #document
(file:///V:/test/Adams/test1.xsl, line 7, column 18)
XSLT message: math:abs available, source tree node: #document
(file:///V:/test/Adams/test1.xsl, line 12, column 22)
<?xml version="1.0" encoding="UTF-8"?>
<transformed xmlns:test="urn:colina.demon.co.uk:domwriter-test-one"
xmlns:math="http://exslt.org/math" value="3"/>
I tested with Xalan 1.4 and the interim release and got the same results.
So, the bug is in your stylesheet, and the way you capture output from the
processor, because you missed the error message.
Dave
|---------+--------------------------->
| | Colin Paul Adams|
| | <colin@colina.de|
| | mon.co.uk> |
| | |
| | 03/04/2003 10:12|
| | PM |
|---------+--------------------------->
>--------------------------------------------------------------------------------------------------------------------------------|
| |
| To: xalan-c-users@xml.apache.org |
| cc: (bcc: David N Bertoni/Cambridge/IBM) |
| Subject: function-available not working |
>--------------------------------------------------------------------------------------------------------------------------------|
Well, it seems my problems with EXSLT were nothing of the kind.
The following transform does not produce any output (messages or a
document element) at all:
<?xml version='1.0'?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:test="urn:colina.demon.co.uk:domwriter-test-one"
xmlns:math="http://exslt.org/math">
<xsl:template match="/">
<xsl:message>
<xsl:text>math:abs to be tested</xsl:text>
</xsl:message>
<xsl:when test="function-available('math:abs')">
<xsl:message>
<xsl:text>math:abs available</xsl:text>
</xsl:message>
<transformed value="{math:abs(-3)}" />
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>math:abs not available</xsl:text>
</xsl:message>
<nottransformed />
</xsl:otherwise>
</xsl:template>
</xsl:transform>
Is this a bug, or have I missed something?
(If I remove all the function-avaialble stuff, then it wouks as expected.)
--
Colin Paul Adams
Preston Lancashire