Lab 1: Delete the Empty Elements

In this folder is juicers.xml

Open it and examine it. You will see that some of the
elements are empty, e.g.


   <weight></weight>


You are to create a pipeline that:

1. Inputs into the pipeline juicers.xml

2. Deletes all the empty elements.


There is a built-in XProc step called p:delete that can be
used to delete the empty elements. Here's its skeletal structure:


<p:delete match="XPath expression"
          name="give this step a name">
    -- input port --
</p:delete>


All the elements identified by the XPath expression will be deleted.

Here is an XPath expression that selects all the empty elements:


   //*[.='']


See lab1-pipeline.gif for an image of the pipeline you are to create.
(open the gif image in a browser)


Notes: 

A. Atomic steps (such as the p:delete step) cannot take p:output, so
don't use p:output in p:delete. (You'll get an error if you do)


B. The output of p:delete is automatically routed to the next step (in this case,
the next step is the p:output of the pipeline), so don't connect the pipeline's 
output to p:delete.


C. You need to connect the input of the pipeline to juicers.xml, and
p:delete's input port to the pipeline's input port. The port name for 
p:delete's input port is: source


D. Name your pipeline file: delete.xpl


E. When you've implemented your pipeline, open a DOS window, change
directory to this folder, and type this at the command prompt: run
Or, use Oxygen XML.


F. If you implemented your pipeline correctly, you should see the juicers
document without any empty elements.


G. Be sure to give the pipeline a meaningful name, and the p:delete step a
meaningful name.