xml - Xproc: passing a dynamic href to <p:http-request> -
i have pipeline runs xslt on input, doing put of result database via <p:http-request>
step.
the tricky bit here need build dynamic href using metadata output of <p:xslt>
xml.
pseudo code here of i'm trying achieve:
<p:xslt name="xslt1"> <p:input port="stylesheet"> <p:document href="xslt-1.xslt" /> </p:input> </p:xslt> <p:variable name="href" select="concat('http://localhost:8000/myrestendpoint?uri=/mydb/', /*/@name, /*/@number,'.xml')"/> <p:sink /> <p:insert position="first-child" match="c:body"> <p:input port="source"> <p:inline> <c:request href="{$href}" auth-method="basic" username="user" password="pw" method="put"> <c:body content-type="text/xml" > </c:body> </c:request> </p:inline> </p:input> <p:input port="insertion"> <p:pipe step="xslt1" port="result" /> </p:input> </p:insert> <p:http-request omit-xml-declaration="false" encoding="utf-8"> <p:input port="source"/> </p:http-request>
as can see in <p:variable>
step, i'm trying build string , construct attribute values output xml of <p:xslt>
step , feed <c:request>
step's href option.
i've tried adding <p:attribute match>
step alter href attribute before <p:http-request>
doesn't grab /*/@name
, /*/@number
values need:
<p:add-attribute match="/c:request" attribute-name="href"> <p:with-option name="attribute-value" select="concat('http://localhost:8000/myrestendpoint?uri=/mydb/', /*/@name, /*/@number,'.xml')"/> </p:add-attribute>
alright able figure out.
looks adding <p:add-attribute>
step right approach , issue here error in xpath...
<p:with-option name="attribute-value" select="concat('http://localhost:8000/myrestendpoint?uri=/mydb/', /*/*/@name, /*/*/@number,'.xml')"/>
since put body wrapped in element, needed go 1 more level down reach metadata needed @ root element of xml document (xslt1 output), xpath values needed updated /*/*/@name
, /*/*/@number
.
Comments
Post a Comment