Loading ...
Sorry, an error occurred while loading the content.

17966Re: Using URI templates in XHTML

Expand Messages
  • Philippe Mougin
    Nov 15, 2011
    • 0 Attachment
      > > Interesting. This resonates with the problem Eric wrote about:
      > > dynamically passing a declarative description of constraints on allowed
      > > values for expansion. In your example, you communicate a list of
      > > possible contexts for expansion. A context is a set of value for
      > > performing a given expansion. Do I understand correctly? If so, I'm not
      > > sure why you don't directly pass to the client a list of URI generated
      > > server-side by expanding the "templates" using the various contexts? I'm
      >
      > Well, that surely *is* an option as I mentioned myself, but if you go
      > this path, then you don't need to provide the client with uri-templates
      > nor contexts, and you don't need anything else then the xhtml we already
      > have...
      > So I just assumed you meant this, if not it seemed to make your question
      > void?

      Yes, I need client side expansion, as I want to use URI templates to dynamically communicate how to build certain URIs. However, my clients are purpose-built programs whose developers will be given some informations out of band. For example, I might communicate http://example.com/stockquote/{symbol} dynamically, associated with a given rel value for finding it in a representation, but specify in my service documentation (i.e., out of band) that it must be expanded using a variable named "symbol" whose value must be the stock symbol of the company you want a stock quote for.

      So my main question is what you labeled as "question [1]": what is the best way to embed such an URI template in XHTML.

      One viable option is creating a specific "link" element with a rel and hreft attribute, which would give:

      <html xmlns="http://www.w3.org/1999/xhtml" xmlns:my="http://example.com/my">
      <body>
      <my:link rel="http://example.com/rels/stockquote" hreft="http://example.com/stockquote/{symbol}" />
      </body>
      </html>

      Another idea I have is to use the existing xrd's link element, which has support for URI templates (xrd is specified at http://docs.oasis-open.org/xri/xrd/v1.0/xrd-1.0.html).

      This would give:

      <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xrd="http://docs.oasis-open.org/ns/xri/xrd-1.0">
      <body>
      <xrd:link rel="http://example.com/rels/stockquote" template="http://example.com/stockquote/{symbol}" />
      </body>
      </html>

      I'd be grateful for any feedback on these as well as other ideas on how to best use URI templates as hypermedia controls in XHTML.

      Philippe
    • Show all 19 messages in this topic