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

Re: Dynamic creation of parameters without @namespace

From: Innovimax SARL <innovimax@gmail.com>
Date: Mon, 4 Aug 2008 00:34:13 +0200
Message-ID: <546c6c1c0808031534k4b2712d7g3973ab907c5ce922@mail.gmail.com>
To: Toman_Vojtech@emc.com
Cc: public-xml-processing-model-wg@w3.org

Vojtech,

It looks like your use case is asking for defining c:param/@name as a
NCName which could be converted to QName if c:param/@namespace is
provided, isn'it ?

Mohamed



On Fri, Aug 1, 2008 at 2:10 PM,  <Toman_Vojtech@emc.com> wrote:
>
> 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:xslt>
>    <p:input port="source">
>      <p:pipe step="main" port="source"/>
>    </p:input>
>    <p:input port="parameters">
>      <p:pipe step="generate" port="result"/>
>    </p:input>
>  </p:xslt>
>  ...
> </p:pipeline>
>
> 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">
>    <p:inline>
>      <c:param xmlns:c="http://www.w3.org/2007/03/xproc-step"
> xmlns:x="http://whatever.com" name="x:whatever"/>
>    </p:inline>
>  </p:input>
>  <p:with-option name="to" select="..."/>
> </p:namespace-rename>
> <p:string-replace>
>  <!-- replace "x:whatever" in c:param/@name with "x:parameter-name" -->
> </p:string-replace>
>
> 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">
>    <p:inline>
>      <c:param xmlns:c="http://www.w3.org/2007/03/xproc-step"/>
>    </p:inline>
>  </p:input>
>  <p:with-option name="attribute-value" select="..."/>
> </p:add-attribute>
> <p:add-attribute attribute-name="namespace">
>  <p:with-option name="attribute-value" select=".../>
> </p:add-attribute>
>
> 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).
>
>
> Regards,
> Vojtech
>
>



-- 
Innovimax SARL
Consulting, Training & XML Development
9, impasse des Orteaux
75020 Paris
Tel : +33 9 52 475787
Fax : +33 1 4356 1746
http://www.innovimax.fr
RCS Paris 488.018.631
SARL au capital de 10.000 
Received on Sunday, 3 August 2008 22:34:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 3 August 2008 22:34:57 GMT