- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Sun, 14 Dec 2008 13:08:49 +0000
- To: Dave Pawson <dave.pawson@gmail.com>
- Cc: "XProc Dev" <xproc-dev@w3.org>
Dave, On 14 Dec 2008, at 11:35, Dave Pawson wrote: > So how do I wrap it in a simple inline element to append to the > result stream? > Both your examples use variables 'indirectly'? > In xslt terms wheres the equivalent of > > <doc> > <xsl:value-of select='$myvar'/> > </doc> I think the easiest way to do it is with XSLT of the kind I gave you in the previous example. There's no standard step that I can see for "replace the content of an element with a string", which is essentially what you need to do to create an element from a string. You could use p:string-replace: <p:pipeline xmlns:p="http://www.w3.org/ns/xproc"> <p:variable name="product-name" select="'Fribble Widgets'" /> <p:string-replace match="product/text()"> <p:input port="source"> <p:inline> <product>product-name</product> </p:inline> </p:input> <p:with-option name="replace" select="concat('"', replace($product-name, '"', '""'), '"')" /> </p:string-replace> </p:pipeline> but the p:with-option there isn't pretty, because the value of the replace option is an XPath expression, so to create a (quoted) string from the value you have in the $product-name variable, you need to concatenate some quotes and then make sure you escape any quotes in the value of the $produce-name variable. Maybe there'd be a use for a p:set-value step. I don't know. Jeni -- Jeni Tennison http://www.jenitennison.com
Received on Sunday, 14 December 2008 13:09:24 UTC