settled on XSLT/XSD pattern for exyus

2007-09-17 @ 23:55#

over the last couple weeks i've ben noodling on the next level pattern for making my exyus engine simpler and, at the same time, more powerful. to do that, i've settled on a new pattern for powering HTTP methods using XSLT and XSD.

the general pattern looks like this:

-- transform incoming arguments into document id
post_args.xsl

-- validate incoming document
post.xsd

-- transform request against store
post_request.xsl

-- transform response from store
post_response.xsl

basically, it works like this:

  1. pass the argument collection into an XSLT document to produce the proper document-id (if one exists)
  2. if the request contains an Entity, validate that entity using XSD
  3. use XSLT to transform the Entity into a valid execution against the resource store
  4. usd XSLT to transform the results from the resource store into the proper response

obviously, some HTTP methods will not contain entity documents (DELETE and GET). others may not contain responses (DELETE, POST and PUT). in that case, some of these control documents are not needed or will be ignored. finally, the GET method is a special case. if the request contains a document-id, then the GET may be handled quite differently than if there is no document-id. in that case, there might be a get_request_item.xsl and get_request_list.xsl, etc.

as usual, i'm beating things up right now, but am confident this is heading in the right direction. the result should be a very simple pattern for implementing a resource type in code. and this implementation will be leveraging existing engines (RegEx, XSLT, XSD, etc.) to reduce the code needed to get the work done while still offering lots of flexibility and power.

code