Use Case 5.15: Parse and/or Serialize RSS descriptions

The use case is here:

  http://www.w3.org/TR/xproc-requirements/#use-case-rss-descriptions

Parsing descriptions looks like:

<p:pipeline xmlns:p='http://www.w3.org/2006/XProc'
         xmlns:c='http://www.w3.org/2006/XProc/Components'
         xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
         xsi:schemaLocation='http://www.w3.org/2006/XProc pipeline.xsd'
         xmlns:xhtml='http://www.w3.org/1999/xhtml'
 
xmlns:t="http://www.smallx.com/Vocabulary/Services/Tideinfo/2005/1/0"
         xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <p:input name="feed"/>
    <p:output name="processed-feed" from="final"/>

    <!-- parse the children of the RSS description elements so that it 
can be processed
         with XML tools -->
    <p:for-each select="description" over="feed" to="iteration">
       <p:output name="final" from="parse"/>
       <p:step kind="p:parse">
          <p:input name="document" from="iteration"/>
          <p:output name="parse" from="result"/><!-- Note: the component 
names this -->
          <p:parameter name="type" value="html"/>
          <p:parameter name="children" value="true"/>
          <p:parameter name="default-namespace" 
value="http://www.w3.org/1999/xhtml"/>
       </p:step>
    </p:for-each>

</p:pipeline>


Escaping (serializing) descriptions looks like:

<p:pipeline xmlns:p='http://www.w3.org/2006/XProc'
         xmlns:c='http://www.w3.org/2006/XProc/Components'
         xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
         xsi:schemaLocation='http://www.w3.org/2006/XProc pipeline.xsd'
         xmlns:xhtml='http://www.w3.org/1999/xhtml'
 
xmlns:t="http://www.smallx.com/Vocabulary/Services/Tideinfo/2005/1/0"
         xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <p:input name="feed"/>
    <p:output name="processed-feed" from="final"/>

    <!-- serialize the children of the description to be compliant with 
RSS -->
    <p:for-each select="description" over="feed" to="iteration">
       <p:output name="final" from="serialize"/>
       <!-- serializes the children into a text node -->
       <p:step kind="p:serialize">
          <p:input name="document" from="iteration"/>
          <p:output name="serialize" from="result"/><!-- Note: the 
component names this -->
          <p:parameter name="children" value="true"/>
       </p:step>
    </p:for-each>

</p:pipeline>

--Alex Milowski

Received on Wednesday, 5 July 2006 20:49:46 UTC