[xsl] Solved - expected ) exception

Subject: [xsl] Solved - expected ) exception
From: elizabeth Hostetter <aellath@xxxxxxxxxxxxx>
Date: Fri, 30 Sep 2011 06:14:35 -0700
In the first <xsl:when>, you need a slash (/) between "." and
"DisplayPrice".  Because those two items together without a slash
between are not a valid XPath "sub-expression", which is what the
parser would expect to find between the parenthesis of a function
call, the parser assumes that the sub-expression must end after the
".", so it "expects" the closing ")".

-Brandon :)

Brandon - thank you. i feel a fool for not seeing that - it *is* in the sample code i was following, but i guess i'd seen it too much to notice now. that ggot rid of the exception. it's still not detecting the *sale*, but now that the page is fully loading, i can fiddle with that.

thank you!

An XML name cannot begin with ".". So after


the only things that can legally come next are either ")", or an
operator such as "+", "div", or "/".

It's not a good message. Sometimes when you get a poor error message,
it's worth trying another XSLT processor to see if it gives you a better
one. Saxon on this one gives you:

Error at xsl:when on line 24 column 67 of test.xsl:
  XPST0003 XPath syntax error at char 9 on line 24 in
    expected ")", found name "DisplayPrice"

The "expected ')'" when there are many other symbols that could occur is
symptomatic of a top-down parser, which typically only reports what it
was expecting as a 'last resort'. A bottom-up parser that builds a
finite-state machine would know all the possible symbols that could
validly occur in this context.

Michael Kay

Michael, thank you! unfortunately, i have no control over whatever XSLT processor IAModules uses, so i have to deal with the cryptic exception messages. Luckily, i do my changes incrementally (school of hard knocks, indeed!), so i can usually narrow down *where* the error is - then it's just a matter of finding it. i wasn't looking at anything but parens this time . . .

believe me, if i could run it through a processor *before* uploading it, i would - but i'd need jsps and the XML, and they won't give me that. i did get them to put up a dev environment for me to work on to get code that doesn't break *before* modifying the live site. ;)

Thanks again!


Current Thread