W3C home > Mailing lists > Public > uri@w3.org > October 2007

Re: URI Templates - optional variables?

From: John Cowan <cowan@ccil.org>
Date: Mon, 15 Oct 2007 14:03:53 -0400
To: Mike Schinkel <mikeschinkel@gmail.com>
Cc: 'Stefan Eissing' <stefan.eissing@greenbytes.de>, uri@w3.org
Message-ID: <20071015180353.GJ4791@mercury.ccil.org>

Mike Schinkel scripsit:

> I'll throw my earlier suggestions to use a name and colon where the default
> is just {var}:
> 
> 	{<arg|var}  ->   {prefix:var,stuff}
> 	{>arg|var}  ->   {append:var,stuff}
> 	{,arg|var}  ->    {join:var,stuff}
> 	{&arg|var}  ->   {joinlist:var,stuff} 

The reason that Joe's proposal uses | (an earlier draft used :) to separate
stuff and var(s) is that | is illegal in URIs.  You need some way to escape
it in the template, such as \|, but this only comes up when you want an
explicit "%7E" sequence in the URI.

(Which reminds me:  Joe doesn't actually say that non-URI characters
appearing in the stuff should generate %-escapes in the result, but
that's the intention.)

You can't put the var first because there may be multiple vars.

-- 
John Cowan                                cowan@ccil.org
I amar prestar aen, han mathon ne nen,    http://www.ccil.org/~cowan
han mathon ne chae, a han noston ne 'wilith.  --Galadriel, LOTR:FOTR
Received on Monday, 15 October 2007 18:04:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 13 January 2011 12:15:37 GMT