W3C home > Mailing lists > Public > xproc-dev@w3.org > June 2012

p:add-attribute

From: Nic Gibson <nicg@corbas.co.uk>
Date: Thu, 21 Jun 2012 15:46:44 +0100
Message-Id: <E56DE383-FB63-48F1-888A-682F8336DE42@corbas.co.uk>
To: XProc Dev <xproc-dev@w3.org>
Afternoon all. Been a while since I need to ask a dumb question but here I am again.

I'm trying to track down an odd behaviour of an XProc script when run within Oxygen. Specifically, I'm trying to output the input options because I may be configuring them wrongly in Oxygen. 
That's led to my using p:add-attribute to dump out an input in the result document. 
It's not working as I would expect. The relevant lines of the script are below:

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:c="http://www.w3.org/ns/xproc-step"
    xmlns:cx="http://xmlcalabash.com/ns/extensions" name="docx2xml"
    xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
    xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
    xmlns:prop="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
    xmlns:rels="http://schemas.openxmlformats.org/package/2006/relationships" version="1.0"
     type="corbas:docx2xml"
    xmlns:corbas="http://www.corbas.co.uk/ns/xproc" xmlns:temp="http://www.corbas.co.uk/ns/temp">

    <p:output port="result" primary="true">
        <p:pipe port="result" step="the-end"/>
    </p:output>

    <p:option name="package-url" required="true"/>

    <p:import href="library-1.0.xpl"/>


	<!-- A large amount of code deleted here -->
        
    <p:identity name="create-sequence">
        <p:input port="source">
            <p:pipe port="result" step="get-doc"/>
            <p:pipe port="result" step="get-styles"/>
            <p:pipe port="result" step="get-numbering"/>
            <p:pipe port="result" step="get-footnotes"/>
            <p:pipe port="result" step="get-endnotes"/>
            <p:pipe port="result" step="get-app-properties"/>
            <p:pipe port="result" step="get-core-properties"/>
        </p:input>
    </p:identity>

    <p:wrap-sequence name="wrap-up" wrapper="word-doc"
        wrapper-namespace="http://www.corbas.co.uk/ns/temp"/>

    <p:add-attribute name="insert-url" xmlns:temp="http://www.corbas.co.uk/ns/temp"
        attribute-name="package-url" 
         match="/temp:word-doc">
        <p:with-option name="attribute-value" select="$package-url"/>
    </p:add-attribute>


The problem is the attribute value. It's empty. My result document now looks like:

<word-doc xmlns="http://www.corbas.co.uk/ns/temp" package-url="">
		<!-- several thousand lines of markup -->
</word-doc>

What blindingly obvious thing am I doing wrong given that 'package-url' definitely has the right value at the start of this script (when run from the command line)?

cheers

nic

--
Corbas Consulting / @CorbasLtd
Digital Publishing Consultancy and Training
http://www.corbas.co.uk, +44 (0)7718 906817/+44 (0)1273 930765	
	
Received on Thursday, 21 June 2012 16:51:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 21 June 2012 16:51:16 GMT