- From: <Toman_Vojtech@emc.com>
- Date: Fri, 1 Aug 2008 08:10:24 -0400
- 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: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
Received on Friday, 1 August 2008 12:11:22 UTC