Discussion:
transform() function in 595
C. M. Sperberg-McQueen
2014-05-07 00:57:37 UTC
Permalink
A project I'm involved with is running into problems with Chrome 34; I was glad
to see that there is already a workaround for them, so I have checked out
version 595 and am testing it. I have run into a problem.

The form I am testing uses the transform() function to display nicely formatted
read-only versions of some complex information. Under 1.0RC it works as
intended (except in Chrome 34 -- but that's where this story started, isn't it?).
Under 595, when the user loads a document, I get a long series (one per
item in a repeat) of error alerts reading:

http://localhost
XSLTForms Exception
----------------
Error evaluating the following XPath expression:
transform(., 'display-segments-aligned.xsl')
transform() : Invalid number of arguments
transform() function must have two arguments exactly

The cause appears to be that the error message transformInvalidArgumentsNumber
has not changed, but at some point the argument-checking in the transform
function changed from

if (arguments.length !== 2) {
throw XsltForms_xpathFunctionExceptions.transformInvalidArgumentsNumber;
}

to

if (arguments.length < 3) {
throw XsltForms_xpathFunctionExceptions.transformInvalidArgumentsNumber;
}

It's easy enough to add a third argument to my calls to transform() -- if I have
understood correctly, it should be 'false' -- or to supply false as the default.

Question 1: am I right that the third argument should be 'false'
for external stylesheets, and 'true' for strings containing an XSLT stylesheet?

Question 2: What are arguments 4 and following for? They appear to be
for stylesheet parameters (which would really make me happy); is that true?

Question 3: Is this documented somewhere? (One of the reasons I like
XForms is that I don't want to have to learn to read Javascript really fluently.)
--
****************************************************************
* C. M. Sperberg-McQueen, Black Mesa Technologies LLC
* http://www.blackmesatech.com
* http://cmsmcq.com/mib
* http://balisage.net
****************************************************************
Loading...