vCard output from XProc?

What I did:

Wrote XSL to convert xCard (RFC 6351) →  vCard 3 (RFC 2426)
(Yes, I realize that xCard is based on vCard 4 (RFC 6350), and that I’m producing vCard 3 output. My current project requires this.)
Tested XSL successfully
Wrote XProc to do the following:
pre-process xCard document
use the previous XSL to convert it to vCard
Using:
Oxygen v14 
Mac OS X 10.8 (“Mountain Lion”)


Problem:

Keep getting errors about non-XML output
Pipeline is (currently) a <p:declare-step />
Output is:

<p:output   port     ='result'
            primary  ='false'
            sequence ='true'
/>

Scenario: XPROC PIPELINE
XProc file: /Users/amrogers/Desktop/2012 Summer Camp /generate-vcards.xpl
Engine name: Calabash XProc
Severity: error
Description: err:XD0001 : XD0001 It is a dynamic error if a non-XML resource is produced on a step output or arrives on a step input.



This is my first attempt at using XProc in a long time.  So, sorry if this is a n00b question.  


<rant>
 One reason I haven’t used XProc for so long is because of frustrations like this.  Apart from my gripes about the syntax, there’s the error messages.  

 How am I supposed to troubleshoot the above error?  

 Exactly what was the “non-XML resource” that was produced?  Can’t the error even give me a snippet of it?

 On which step’s “output or […] input” did the “non-XML resource” occur?

 Plus, I thought it was okay for a step not to produce any output if it specified @sequence ='true',  implying zero or more documents on the output.  
</rant>


And now, the source code (forgive the indentation strangeness—pasting the source caused the glitch):

<?xml version='1.0' encoding='UTF-8'?>
<p:declare-step
 name  ='generate-vcards'
 
 version  ='1.0'
 xpath-version   ='2.0'
 
        xmlns:p  ='http://www.w3.org/ns/xproc'
 xmlns:c  ='http://www.w3.org/ns/xproc-step'
 xmlns:err ='http://www.w3.org/ns/xproc-error'
 xmlns:xs ='http://www.w3.org/2001/XMLSchema'

 xmlns:cx ='http://xmlcalabash.com/ns/extensions'
 
     xmlns:xsl ='http://www.w3.org/1999/XSL/Transform'
     xmlns:h         ='http://www.w3.org/1999/xhtml'
 
     xmlns:xcard     ='urn:ietf:params:xml:ns:vcard-4.0' 
     xmlns:vcard     ='http://www.w3.org/2001/vcard-rdf/3.0#' 
     xmlns:nc        ='urn:new-culture:summer-camp:east:2012'
 
 xmlns:local ='#empty'>
 

 
    <!--
  I/O
 ======================================================================== -->
 <p:input port     ='source' />
 
     <p:output    port     ='result' 
       primary  ='false'
              sequence ='true' 
        />
    
    
     <!-- 
  OPTIONS
 ======================================================================== -->
 <!--<p:option
  name  ='opt1'
  required ='false'
  select  =" '' " 
 />
 <p:option
  name  ='opt2'
  required ='false'
  select  =" '' " 
 />-->
 
 

 <!-- 
  SERIALIZATIONS 
  May bind to any output (not just "result").
 ======================================================================== -->
 <!--<p:serialization
  port    ='result' 
   method              ='text'
   encoding   ='UTF-8'
 />-->
 
 
 
 <!-- 
  VARIABLES
 ======================================================================== -->
        <!--<p:variable name    ='dude...' 
                        select  ='"...I know!"'
 />-->
    
    
    
    <!-- 
  IMPORTS
 ======================================================================== -->
    <!--
        Calabash extension steps
  (
    Network connection irrelevant; 
    imported from Calabash-bundled library
  )
    -->
 <p:import href='http://xmlcalabash.com/extension/steps/library-1.0.xpl'    />
    
 
 
 <!--
  MAIN PIPELINE CONTENT
 ======================================================================== -->
 <p:group name='xcard-cleanup'>
     <p:delete match='xcard:n/xcard:*[ not(@nc:share) ]/text()' />
            <p:delete match='xcard:adr/xcard:*[ not(@nc:share) ]/text()' />
     <!--     
            Remove private data  
            (ignores xcard:categories for now, so I can customize it)
        -->
     <p:delete match='xcard:vcard//*[
      not(ancestor-or-self::xcard:n              ) and               
      not(descendant-or-self::xcard:n            ) and
      not(ancestor-or-self::xcard:adr            ) and
      not(descendant-or-self::xcard:adr          ) and
      not(ancestor-or-self::xcard:categories     ) and
      not(ancestor-or-self::node()[ @nc:share ] or
          descendant-or-self::node()[ @nc:share ])
      ]' 
  />
 </p:group>
    
 
    <p:xslt name='xsl-to-vcard'>
        <p:input port='stylesheet'>
            <p:document href='${HOME}/Library/Application Support/oXygen/templates/vcard.xsl' />
        </p:input>
        <p:input port='parameters'>
            <p:empty />
        </p:input>
    </p:xslt>
    
    <p:sink />
    
    <p:store   name='stored-doc' 
            href='vcard-pipeline-output.vcf'>
     <p:input port='source'>
         <p:pipe port='result' step='xsl-to-vcard' />
     </p:input>
 </p:store>
    
</p:declare-step>


Help me xproc-dev list…you’re my only hope! ☺ 

—Tony

Received on Monday, 20 August 2012 15:36:37 UTC