|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: dl/dt/dd matching
[Paul Prescod] >Actually, it very easy to solve if you solve it in the right place. You >need to augment the input schema (DTD, XSchema, whatever) so that it can >guide the grouping of things. > ><!ELEMENT DL (!DTITEM)> ><!GROUP DTITEM (DT, DD)> > >Given this document: > ><DL> > <DT>...</DT><DD>..</DD> ></DL> > >You get this tree: > >DL > DLITEM > DT > DD > DLITEM > DT > DD > >David Peterson may have invented this idea in the SGML context, but in >retrospect it is a straightforward application of the computer science >concept of "non-terminal" in a context-free-grammar. > Three unrelated points about this:- 1) The easiest way to solve it is to do a tree transformation prior to the tree formatting so that DT,DD pairs get "wrapped" in a parent element. (In an SGML processing toolkit called IDM that I wrote a century ago we had "generic transformations" for this sort of thing and a simplistic query language. Worked great for formatting dt/dd type problems though.) Kinda like SAX filters now that I think of it... 2) An analogy can be drawn with Jackson System Design(JSD) in which a data source can be parsed w.r.t. many different data models to generate different parse trees. JSD did not specify a declarative syntax with which to achieve the "non-terminals" though. 3) An idea struck me reading Dick Grune's (Markup Technologies '98) book on parsing related to the dt/dd problem. So called "Van Wijngaarden grammars" could be useful here. These are genuine "meta-dtd's" in which expressions in the grammar are used to generate *other* expressions in the grammar. The thought that struck me was that you could parse w.r.t. the VW form and achieve "non-terminals" in the parse tree or just pre-process the VW form to generate standard extended regular expressions for a standard DTD parse. </Sean> http://www.digitome.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








