DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG� RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=35228>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND� INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=35228 Summary: XSP expressions (attribute value/text interpolation) Product: Cocoon 2 Version: Current SVN 2.1 Platform: Other OS/Version: other Status: NEW Keywords: PatchAvailable Severity: normal Priority: P2 Component: blocks AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] In [1] in we discussed an XSP expression syntax for attribute value and text expressions. This patch makes expressions available. In XSP, you now can write: <elem attrib="{#expression}" which will be expanded to: <elem><xsp:attribute name="attrib"><xsp:expr>expression</xsp:expr><xsp:attribute></elem> or <elem>Hello #user.getFullName</elem>, which will be expanded to <elem>Hello <xsp:expr>user.getFullName</xsp:expr></elem> Writing {##text} will prevent expansion and will be replaced by the text "{#text}". Inside expressions, write "##" to get "#" and "#}" to get "}". This works in XSPs as well as logicsheets. The '#' was chosen out of the discussed characters because it is IMO least likely to occur in an expression in the used languages. This feature is turned on by default and can be turned off by setting "attribute-value-interpolation" or "text-interpolation" to "false" in cocon.xconf: <markup-languages> <xsp-language ... attribute-value-interpolation="false" text-interpolation="false"> ... </xsp-language> </markup-language> It can be turned on or off on a per-XSP-/logicsheet-basis by setting attributes "attribute-value-interpolation" or "text-interpolation" of the top level element to true or false. Note that these attributes must belong to the "http://apache.org/xsp" namespace. How it works: New class XSPExpressionParser is a parser for the expressions. New class XSPExpressionFilter is a filter that gets SAX events with embedded expressions and generates SAX events for expanded expressions. This is used in LogicSheet to filter read logicsheers and in XSPMarkupLanguage to filter the XSP. Changes to existing code. LogicSheets need to know the namespace and uri of the markup language in order to replace expressions. Therefor AbstractMarkupLanguage needs to know this when reading logicsheets. This meant that I had to move this configuration information from parametrize to configure. It is unclear to me anyway, why AbstractMarkupLanguage used both methods at the same time (which are described as "incompatible" in the Avalon documentation). The old PreProcessFilter wraps text() nodes in <xsp:text> elements inside some tags (See [2]). It is unclear to me why this was done, and all XSPs I've tested worked without this. I got no reponse on the list, so I left this feature out of the new PreProcessFilter. If any of the above changes need further discussion, clarification or change, please tell me and I'll update the patch. This patch also should be applied to 2.2. If it does not work, again please tell me and I'll make a 2.2 patch available. [1] http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=111693513631888&w=2 [2] http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=111778627925208&w=2 -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.
