I'm sorry I'm a little late to join the discussion. I'm very much in support of the idea of more expressive and powerful conditionals. As Frank mentioned, I already implemented the original proposal. I also like Andrea's and Frank's version that would go towards a single condition attribute – that would be more complicated to implement but probably easier for style authors to write.
What I do like about the current conditionals (and also about Frank's proposal) is the high-level structure: <choose> <conditonal block> … </conditonal block> <conditonal block> … </conditonal block> … <conditonal block> … </conditonal block> </choose> That is to say, one clearly defined root element per conditional branch with no nested children. I think this is easy to read and easy to implement. I am not in favor at all of adding new (optional) child elements like <and> <or> etc. In my experience, dependencies between nodes always lead to less straight forward and less elegant implementations and consequently to more errors. I also don't think it's fair to use XSLT as a measure for how easy it is to implement a feature cleanly unless you provide an actual XSLT implementation. If we wanted to pick one language for such measurements I would suggest to use Haskell for now, because it is a functional language and we do have an actual implementation to look at. Sylvester On Apr 16, 2013, at 3:18 PM, Rintze Zelle wrote: > On Tue, Apr 16, 2013 at 2:25 AM, Charles Parnot > <[email protected]> wrote: >> >> <if type="article-journal"> >> <or variable="volume issue" variable="volume" variable = "issue" /> >> <text variable = "volume"> >> <if /> >> >> <if type="article-journal"> >> <or variable="volume" /> >> <or variable="volume" /> >> <text variable = "volume"> >> <if /> >> >> <if type="article-journal"> >> <and> >> <not variable="volume" /> >> <or variable="issue" /> >> <and /> >> <text variable = "volume"> >> <if /> >> >> with some implicit `and` when multiple attributes are in the <if>, <and>, >> <or> or <not> nodes. > > If we kept the "match" attribute around (and limit its scope to the > element it is used in), we wouldn't need cs:not, and we might even get > away with forgoing cs:or. In place of Frank's proposed cs:then (to > contain the output of the conditional), we could also nest the output > within the additional conditionals. Recasting Frank's unit test XML: > > <choose> > <if type="article-journal" variable="volume issue" match="all"> > <and-if is-numeric="volume issue" match="nand"> > <text value="is an ARTICLE-JOURNAL with both VOLUME and > ISSUE, but one of them is non-numeric"/> > </and-if> > </if> > (I don't know what English term to introduce as a value for "match" to > cover "but one of them is non-numeric"; going with "nand" for now) > > <else-if type="article-journal" variable="volume issue" > is-numeric="volume issue" match="all"> > <text value="is an ARTICLE-JOURNAL with both VOLUME and > ISSUE, and both of them are numeric"/> > </else-if> > (this one already works with current CSL) > > <else-if type="article-journal" match="none"> > <and-if variable="edition"> > <text value="is not an ARTICLE-JOURNAL, and has an EDITION"/> > </and-if> > </else-if> > <else-if type="book"> > <and-if variable="edition" match="none"> > <text value="is a BOOK, but has no EDITION"/> > </else-if> > > <else-if type="chapter" variable="author" match="all"> > <text value="is a CHAPTER, and has an AUTHOR"/> > </else-if> > (this one also already works with current CSL) > > </choose> > > ---------- > > Rintze > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs for building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter > _______________________________________________ > xbiblio-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/xbiblio-devel ------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr _______________________________________________ xbiblio-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/xbiblio-devel
