Jump to contentWelcome to Vionta.net
Salvora: Mapping Samples

The following element shows a listing sample of a request/mapping file, with folders configuration, transformations, etc.

The elements that maps requests have path (external exposed http paths) and urls (internal consumed internal-paths of the resources). We use two variants, BASE paths that expose an initial key of a set of files or resources and single paths that map to a single internal-paths or resource. When you use the "base-" paths it is meant for sets of paths and "path"/"rul" it is meant for single resources. For every base-path or single path there should be a corresponding base-internal-path or internal-path.


<?xml version="1.0" encoding="UTF-8"?>
<sal:salvora-application
    xmlns:sal="net:vionta:schemas:salvora:mapping:v1.0"
    >
  <collection
      name="configuration" base-path="configuration"
      write-allowed="false" file-list="false" >
    <description>Configuration path</description>
  </collection>
  <collection
      name="form" base-path="form"
      write-allowed="false"
      >
  </collection>
  <collection
      name="xsltforms" base-path="xsltforms"
      write-allowed="false" />
  <collection
      name="data" base-path="data"
      file-list="true"
      write-allowed="true" />
    <collection
      name="config" base-path="config"
      file-list="false"
      write-allowed="true" />

    <collection name="primera"
		    internal-path="transformations/archivos-sample.xml"
		    path="issues"
		    type="local_file"
		    >

	<step name="primera" 
	    source="transformations/lista-archivos.xsl" />

    </collection>


    <collection
	name="issues-index" base-path="index"  write-allowed="false" >
          <!-- a process trigger to be called when the file is requested. 
	        The (xproc iii) trigger can be called before or after the 
		call is served -->
	  <trigger name="file-indek" before="true"
		   source="trigger/issue-list.xpl" />
    </collection>
    
    
</sal:salvora-application>

      

Before and After

Both transformations and triggers can be executed before or after the REST request is frocessed. By default both are performed before the content processed but you can set the "before" attribute to false so they are fired after the document request is processed.

This can be used to customize the file before is sent, save a copy or generate a index of certain files after it is stored, for example.


	
    <collection
	name="issues-index" base-path="index"   >
      	  <trigger name="file-indek" before="true"
		   source="trigger/issue-list.xpl" />
    </collection>

      

Parameters

We have three kind of parameters that can be passed to the transformations and processes.

  1. Regular parameters:

    literal parameters that can be passed with a fixed value.

  2. Request parameters:

    The HTTP parameters that are sent as part of the request query string.

  3. Path parameters:

    Path parameters can be inferred from the request path as name patterns.

Both Request and Path Parameters can be mapped with a different name in the transformation call from the one used in the request or the path definition


	    <transformation
      name="xslt_transformation_test" type="local_file"
      path="options.xml" internal-path="conf/options.xml"  >
      <step name="instancecode" type="xslt" source="trigger/options-view.xsl" >
      
	<request-parameter
	    key="tuno" transformation-param-name="query-param" />
	<parameter
	    key="param-test" value="'setted'" />      
	    </step>
      
  </transformation>


  <transformation name="form-config"
	type="local_file" path="form/:entity/:code.xml"  internal-path="form/:entity.xml"  >

    <step name="instancecode" type="string" >
      <path-parameter
	  key="entity" transformation-param-name="ENTITY" />
      <path-parameter
	  key="code" transformation-param-name="INSTANCE_CODE" />
	  <parameter key="TEMPLATE_LOCATION" value="collections" />
	  </step>
  </transformation>

      

In the case of XProcs parameters are mapped by default to options by default but they can be declared to be used as input ports with the input-port parameter.