Converting content

If you need to convert pipeline content, MCS provides conversion elements for:

If you need to convert pipeline content, MCS provides conversion elements for:

Converting text

If you need to directly translate to a native markup that only supports a certain case, such as WML, you can use the pipeline:convertElementCase element. It switches the case of all element names in its input to either lowercase or uppercase and passes this to the output. You use the mode to specify the case value.

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:urid="http://www.volantis.com/xmlns/marlin-uri-driver"
  xmlns:pipeline="http://www.volantis.com/xmlns/marlin-pipeline">
  <head>
    <title>pipeline:convertElementCase</title>
  </head>
  <body>
    <p>Latest from NYSE for Jive Sports (VBE):</p>
    <pipeline:convertElementCase mode="lower">
      <urid:fetch href="test.xdinc"/>
    </pipeline:convertElementCase>
  </body>
</html>

The test.xdinc file contains the following code.

<DIV xmlns="http://www.w3.org/2002/06/xhtml2">
  <P> 21.50 (+ 2.25) </P>
</DIV>
Note:

This type of conversion is distinct from any conditioning of input markup by the DCI web driver. See Defining HTTP resources for details.

Converting images

You can use the pipeline:convertImageURLToTranscoder to rewrite convertible image URLs (from the img and logo elements) in a page to be routed through the Media Access Proxy (MAP). MAP will use the device characteristics to select the best transcoding rule to use. The required server attribute contains the address of the MAP server.

<?xml version="1.0" encoding="UTF-8"?>
<canvas layoutName="/sample_layout.mlyt">
  <region name="content" xmlns:pipeline="http://www.volantis.com/xmlns/marlin-pipeline"
    xmlns:urid="http://www.volantis.com/xmlns/marlin-uri-driver">
    <pipeline:convertImageURLToTranscoder server="http://localhost:8080/map/ics">
      <urid:fetch href="test.xdinc"/>
    </pipeline:convertImageURLToTranscoder>
  </region>
</canvas>

The test.xdinc file should contain the following code.

<?xml version="1.0" encoding="UTF-8"?>
<p>old logo: <img url="/images/volantis.gif"/></p>

Converting URLs

To translate URLs in content, or strip a specified prefix, you can use pipeline:convertAbsoluteToRelativeURL. Used alone, the baseURL attribute removes the specified part of the path from the input. If you also provide a value in the substitutionPath, MCS will replace the value in baseURL.

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:urid="http://www.volantis.com/xmlns/marlin-uri-driver"
  xmlns:pipeline="http://www.volantis.com/xmlns/marlin-pipeline">
  <head>
    <title>pipeline:convertAbsoluteToRelativeURL</title>
  </head>
  <body>
    <div>
      <pipeline:convertAbsoluteToRelativeURL
        baseURL="http://www.mytestsite.com/"
        substitutionPath="http://localhost:8080/">
        <urid:fetch href="test.xdinc"/>
      </pipeline:convertAbsoluteToRelativeURL>
    </div>
  </body>
</html>

The test.xdinc file contains the following code.

<div xmlns="http://www.w3.org/2002/06/xhtml2">
  <a href="http://www.mytestsite.com/mcs/projects/client-app/index.xdime">Client Framework Demo</a>
</div>

Related topics