W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > August 2008

Dynamic creation of parameters without @namespace

From: <Toman_Vojtech@emc.com>
Date: Fri, 1 Aug 2008 08:10:24 -0400
Message-ID: <6E216CCE0679B5489A61125D0EFEC7870C039B83@CORPUSMX10A.corp.emc.com>
To: <public-xml-processing-model-wg@w3.org>

Hi all,

As discussed during yesterday's call, I have tried do craft an example
that illustrates my concerns about removing @namespace from c:param.
Maybe it is convincing enough, maybe not...

Consider the following pipeline:

<p:pipeline xmlns:p="http://www.w3.org/ns/xproc" xmlns:foo="...">
  <foo:generate-parameters name="generate"/>
    <p:input port="source">
      <p:pipe step="main" port="source"/>
    <p:input port="parameters">
      <p:pipe step="generate" port="result"/>

Suppose that you want foo:generate-parameters to create a c:param-set
document based on some dynamic criteria. Also suppose you don't want to
use @namespace in c:param elements.

Imagine that the namespace URIs for the parameter names are created
dynamically and are not known in advance. You will have to come up with
some prefix for the namespace (so you can refer to it in the parameter
name). If you declare the prefix on the c:param level (the easiest
option), you can use any prefix as long as it does not clash with the
prefix for "http://www.w3.org/2007/03/xproc-step" namespace used on the
param element (if the param element does not use the default namespace).
I think this is already hard enough to do in plain XProc.

But the main problem is, I think, the creation of namespace
declarations. You can't use p:add-attribute for that. You could probably
do something like:

<p:namespace-rename from="http://whatever.com">
  <p:input port="source">
      <c:param xmlns:c="http://www.w3.org/2007/03/xproc-step"
xmlns:x="http://whatever.com" name="x:whatever"/>
  <p:with-option name="to" select="..."/>
  <!-- replace "x:whatever" in c:param/@name with "x:parameter-name" -->

but I don't consider this is a very nice or safe solution. With
@namespace, you can do:

<p:add-attribute attribute-name="name">
  <p:input port="source">
      <c:param xmlns:c="http://www.w3.org/2007/03/xproc-step"/>
  <p:with-option name="attribute-value" select="..."/>
<p:add-attribute attribute-name="namespace">
  <p:with-option name="attribute-value" select=".../>

This solution is, in my opinion, much cleaner/clearer (although it needs
about the same amount of code as the previous one :-)

You may say that you can overcome the above problems easily by using
XQuery or XSLT, but I really think that performing such a simple task as
creating parameters should be possible using just the "core" XProc (and
with as few workarounds as possible).

Received on Friday, 1 August 2008 12:11:22 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:32:46 UTC