As soon as I learned that Denis had bestowed on us a new 'galileo' flag (bug 247191 [1]), naturally I ran off to bugzilla immediately to apply it to my Plan Queries for OCL.
Well, I had some trouble getting queries to work that search for 'galileo+' (for committed or proposed items). The 'galileo-' flag for deferred items was not a problem. I did overcome, though ... read on.
The problem wasn't in testing queries in a browser. Just paste this into your browser to see that it works:
The problem was in trying to get Dave Carver's XSL transformation (see his excellent blog posting [2]) to execute the query. Naturally, the ampersands need to be escaped as & in the XML. That's OK. The problem was in encoding the '+' modifier on the flag. On my first attempt, doing this in the XML didn't return any results:
The problem was, that the ingenious url-encode.xsl helper stylesheet re-encoded the '%' symbol. Just adding the '%' to the 'safe' variable declaration in the url-encode.xsl file fixed that:
<xsl:variable name="safe">%,+,[]&=?/!'()*-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~</xsl:variable>
The next problem was that the square brackets ('[' and ']') in my search condition for the theme-in-summary scheme wouldn't work after making this change, because the HTTP request sent by the XSLT ended up converting them to the square brackets, which aren't valid characters in a URL query string. At least, I think that's what happened. I definitely got an error from the XSLT processor saying that the '[' was invalid.
The solution to this was to remove the '[' and ']' characters from the 'safe' variable, so that finally I had:
<xsl:variable name="safe">%,+,&=?/!'()*-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~</xsl:variable>
and the HTML resulting from my queries is now just what I need.
Questions for Dave C.:
- Do you anticipate any problems that these changes to the 'safe' variable might cause?
- Is any of this applicable to the plan-rendering script that the Eclipse website uses? Or, is it only relevant to your XSL? Will my queries work with Eclipse's renderer? (I can't test it because OCL is not yet recognized as a Project)
- Would you feel comfortable sharing these changes to the 'safe' variable with the rest of the Eclipse projects?
For a complete example of using the 'galileo' flag in your plan.xml, see my OCL plan file in CVS:
Thanks, Dave, for this extremely helpful tooling that you developed!
Cheers,
Christian
--
Christian W. Damus
Senior Software Developer, Zeligsoft Inc.
Component Lead, Eclipse MDT OCL and EMF-QTV