pipeline:evaluate

Purpose

Allows you to include pipeline operations in an external source. MCS parses the events of the enclosed elements back into the pipeline. For example you can cause a transform to generate urid:fetch or sel:select operation which will be evaluated rather than written to the output.

Contains

Examples

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:pipeline="http://www.volantis.com/xmlns/marlin-pipeline"
  xmlns:webd="http://www.volantis.com/xmlns/marlin-web-driver">
  <head>
    <title>pipeline:evaluate</title>
  </head>
  <body>
    <div>
      <pipeline:evaluate>
        <pipeline:transform href="test.xsl">
          <webd:get url="http://weather.yahooapis.com/forecastrss">
            <webd:parameters>
              <webd:parameter name="p" value="USWA0395"/>
              <webd:parameter name="u" value="c"/>
            </webd:parameters>
          </webd:get>
        </pipeline:transform>
      </pipeline:evaluate>
    </div>
  </body>
</html>

The test.xsl and test.xdinc files should contain the following code.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0"
  xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
  <xsl:output method="xml"/>
  <xsl:template match="/">
    <div xmlns="http://www.w3.org/2002/06/xhtml2">
      <h3>
        <xsl:value-of select="/rss/channel/item/title"/>
      </h3>
      <p>Current Conditions: <xsl:value-of select="/rss/channel/item/yweather:condition/@text"/>,
          <xsl:value-of select="/rss/channel/item/yweather:condition/@temp"/>
        <xsl:value-of select="/rss/channel/yweather:units/@temperature"/>.</p>
      <urid:fetch xmlns:urid="http://www.volantis.com/xmlns/marlin-uri-driver" href="test.xdinc"/>
    </div>
  </xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<div xmlns="http://www.w3.org/2002/06/xhtml2">
  <p> Copyright 2001-2008 All rights reserved </p>
</div>

The following example illustrates the use of pipeline:evaluate with the DISelect markup.

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:pipeline="http://www.volantis.com/xmlns/marlin-pipeline"
  xmlns:webd="http://www.volantis.com/xmlns/marlin-web-driver">
  <head>
    <title>pipeline:evaluate</title>
  </head>
  <body>
    <div>
      <pipeline:evaluate>
        <pipeline:transform href="test.xsl">
          <webd:get url="http://weather.yahooapis.com/forecastrss">
            <webd:parameters>
              <webd:parameter name="p" value="USWA0395"/>
              <webd:parameter name="u" value="c"/>
            </webd:parameters>
          </webd:get>
        </pipeline:transform>
      </pipeline:evaluate>
    </div>
  </body>
</html>

The test.xsl file may contain the following code.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0"
  xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
  <xsl:output method="xml"/>
  <xsl:template match="/">
    <div xmlns="http://www.w3.org/2002/06/xhtml2" xmlns:sel="http://www.w3.org/2004/06/diselect">
      <sel:select>
        <sel:when expr="device:policy-value('supports.client.framework')='true'">
          <p>This device supports the Client Framework 1.</p>
          <div>
            <h3>
              <xsl:value-of select="/rss/channel/item/title"/>
            </h3>
            <p>Current Conditions: <xsl:value-of select="/rss/channel/item/yweather:condition/@text"
              />, <xsl:value-of select="/rss/channel/item/yweather:condition/@temp"/>
              <xsl:value-of select="/rss/channel/yweather:units/@temperature"/>.</p>
          </div>
        </sel:when>
        <sel:otherwise>
          <p>This device does not support the Client Framework 1.</p>
        </sel:otherwise>
      </sel:select>
    </div>
  </xsl:template>
</xsl:stylesheet>

Related topics