RE: Hypermedia - Why

On July 25, 2012 10:27, David Carlisle wrote:
 
> On 25/07/2012 14:59, Rushforth, Peter wrote:
> > Additionally, xml:tref is*new*.  The only other template 
> attribute I 
> > have seen is @template in opensearch
> 
> Why a special template language just for href attributes, and 
> why that particular language?

It seems to be XML, JSON whatever agnostic ie you can put these templates in
any hypermedia.  I wondered why they didn't provide any examples of how
_values_ for the templates would be conveyed and encoded, and I think the answer is
that it is intended to be used in HTML,XML, JSON, pick any media type.

> 
> In XSLT for example, attribute value templates apply to 
> (almost) all attributes and allow XPath evaluation.
> 
> so I can go
> 
> <a href="{$ff}/file-{count(something)}.{$current-ext}"/>
> 
> which might evaluate to
> 
> <a href="http:example.com/file-6.png"/>
> 
> but I can use the _same_ attribute value template syntax on
> 
> <h1 id="{generate-id()}">...</h1>
> 
> which might generate
> 
> <h1 id="andhdhda">....</h1>
> 
> What is special abut URI that you should want a different 
> templating language in that case different from the way that 
> you template any other attribute in the document?

Maybe Expath could define some functions that supported that templating language;
worst case you could define your own set of functions.

URIs on the other hand will benefit from having templates served by the server
which will then be cacheable because the client will use the hypermedia template
to generate the URI, and hence the parameters will always end up in the same
order.

Peter

Received on Wednesday, 25 July 2012 17:21:35 UTC