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

Re: p:add-attribute

From: mozer <xmlizer@gmail.com>
Date: Thu, 21 Jun 2012 21:41:37 +0200
Message-ID: <CAKdwC_Op2fB7a593Nb0-s9irp9YH78HO-zroA_o5C9zaTVtBEQ@mail.gmail.com>
To: Nic Gibson <nicg@corbas.co.uk>
Cc: XProc Dev <xproc-dev@w3.org>
Hi Nic,

Doing this simple sample

<?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" version="1.0">
  <p:input port="source">
    <p:inline>
      <doc>Hello world!</doc>
    </p:inline>
  </p:input>
  <p:output port="result"/>
  <p:option name="test" required="true"/>
  <p:identity/>
  <p:add-attribute attribute-name="foo" match="/*">
    <p:with-option name="attribute-value" select="$test"/>
  </p:add-attribute>
</p:declare-step>


I get

 <doc xmlns:c="http://www.w3.org/ns/xproc-step" foo="bar">Hello world!</doc>


Once I've set in the Options tab the value "bar" for the "test" option in
Oxygen XML 13.2

May be you should look in another direction (namespace or probably
the <p:pipe port="result" step="the-end"/> )

Hope this helps

Xmlizer

2012/6/21 Nic Gibson <nicg@corbas.co.uk>

> 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 19:42:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 21 June 2012 19:42:07 GMT