Saxon evaluating functions and variables unnecessarily
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 93
- Joined: Fri Mar 08, 2013 8:58 am
Saxon evaluating functions and variables unnecessarily
When I use Saxon 9.6 to run a transformation, and it comes across a statement such as this...
...it is evaluating $b whether or not $a is true. For a full discussion, along with result discrepancies, see here:
http://stackoverflow.com/questions/3207 ... alculation
Any suggestions on how to rectify this? Thanks!
Code: Select all
<value-of select ="if ($a) then $a else $b"/>
http://stackoverflow.com/questions/3207 ... alculation
Any suggestions on how to rectify this? Thanks!
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Saxon evaluating functions and variables unnecessarily
Hi,
You haven't mentioned if you are running this in Oxygen as a transformation scenario or in the XSLT debugger. I'm guessing it's the latter, due to the fact that variables are eagerly evaluated only in the debugger (tracing enabled).
Note that this doesn't have anything to do with the expression used, it's only the fact that you are using a variable there and all used variables are evaluated eagerly when debugging.
If you want consistent results, don't use variables and expect them to be lazily evaluated, use functions instead. e.g.
Regards,
Adrian
You haven't mentioned if you are running this in Oxygen as a transformation scenario or in the XSLT debugger. I'm guessing it's the latter, due to the fact that variables are eagerly evaluated only in the debugger (tracing enabled).
Note that this doesn't have anything to do with the expression used, it's only the fact that you are using a variable there and all used variables are evaluated eagerly when debugging.
If you want consistent results, don't use variables and expect them to be lazily evaluated, use functions instead. e.g.
Code: Select all
<value-of select ="if ($a) then $a else eg:very-long-func()"/>
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service