- From: Norman Walsh <ndw@nwalsh.com>
- Date: Mon, 29 Jun 2009 08:26:40 -0400
- To: XProc Dev <xproc-dev@w3.org>
- Message-ID: <m2vdmfw7i7.fsf@nwalsh.com>
James Sulak <jsulak@gmail.com> writes: > Is this a bug, or am I missing something? > > <p:declare-step xmlns:p="http://www.w3.org/ns/xproc"> > > <p:output port="result" primary="true"/> > > <p:option name="foo" select="'data'"/> > > <p:identity> > <p:input port="source"> > <p:inline> > <root>This is some text.</root> > </p:inline> > </p:input> > </p:identity> > > <p:string-replace match="root//text()" replace="replace(., 'text', $foo)"/> The way you've written it, you're asking the p:string-replace step to evaluate the string-replace. That won't work because the variables aren't in-scope inside the step. You want this: <p:string-replace match="root//text()" <p:with-option name="replace" select="concat('replace(., "text", '", $foo, "')")/> Now the XProc processor expands teh value of $foo and passes it to string-replace. A bit ugly, but... Be seeing you, norm -- Norman Walsh <ndw@nwalsh.com> | The first step towards wisdom is http://nwalsh.com/ | calling things by their right | names.--Chinese Proverb
Received on Monday, 29 June 2009 12:27:20 UTC