OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Improved template syntax and connection with XForms (WAS:

[ Lists Home | Date Index | Thread Index ]

Miles Sabin <miles@milessabin.com> wrote:

| Jeni Tennison mailed me offline with an excellent suggestion which I 
| think significantly improves on my proposal.
| 
| She pointed out that we could actually use XPath syntax directly, [...]
| which on expansion looks like this,
| 
|   html[
|     head[
|       title = 'Example 3' and
|       link[@rel = 'stylesheet' and
|            @type = 'text/css' and
|            @uri = '/ss/style.css']] and
|     body/p = 'Hello World']
| 
| which, beautifully, can be used as a selector for the newly created 
| element.
| 
| There's a small cost in that using XPath is slightly more verbose 
| (" and " rather than ","), but that's more than offset, IMO, by the fact 
| that there are no syntactic innovations.

I have to agree that XPath syntax would be a winner on pragmatic grounds.
But I can't resist saying that I find the syntax somewhat cluttered.  An
"operator style" syntax works just as well:

   html =
     head = 
       title = 'Example 3' ;
     + link =
         rel @ 'stylesheet'
       + type @ 'text/css'
       + uri @ '/ss/style.css' ;;
   + body =
       p = 'Hello World' ;;;

For which, a minimum reduced yacc spec (with 15 states) could be:

 %token NAME STRING
 %%
 wff
  : NAME '=' elembody ';' 
  ;
 elembody
  : elemitem
  | elemitem  '+' elembody
  ;
 elemitem
  : NAME  '='  elembody ';'
  | NAME  '@'  STRING  
  | STRING
  ;
 %%






 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS