- From: Dave Pawson <dave.pawson@gmail.com>
- Date: Mon, 15 Dec 2008 10:57:10 +0000
- To: "XProc Dev" <xproc-dev@w3.org>
Just note how long winded it is to do such a simple thing Norm? I'm less sure how clear the use case is for it though. p:insert was the other option I looked at, but I couldn't get that to work either. regards DaveP 2008/12/15 Norman Walsh <ndw@nwalsh.com>: >> Maybe there'd be a use for a p:set-value step. I don't know. > > You can certainly write your own. And I'm happy to add it to exproc.org if > there's interest. > > Here's set-value.xpl: > > <p:declare-step type="ex:set-value" > xmlns:c="http://www.w3.org/ns/xproc-step" > xmlns:ex="http://example.com/ns/xproc-example" > xmlns:p="http://www.w3.org/ns/xproc" > exclude-inline-prefixes="c ex p"> > <p:output port="result"/> > > <p:option name="value" required="true"/> > > <p:string-replace match="c:result/text()"> > <p:input port="source"> > <p:inline><c:result>text</c:result></p:inline> > </p:input> > <p:with-option name="replace" > select="concat('"', > replace($value, '"', '""'), > '"')"> > <p:empty/> > </p:with-option> > </p:string-replace> > > </p:declare-step> > > and here's an example of how to use it: > > <p:pipeline name="pipeline" > xmlns:ex="http://example.com/ns/xproc-example" > xmlns:p="http://www.w3.org/ns/xproc"> > > <p:import href="set-value.xpl"/> > > <p:variable name="some-string" select="'my "value'"/> > > <ex:set-value> > <p:with-option name="value" select="$some-string"/> > </ex:set-value> > > </p:pipeline> -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk
Received on Monday, 15 December 2008 10:57:47 UTC