I have an xquery where an instance is defined:
<xf:instance id="table" xmlns="">
<results>
<result>
<interfaceName></interfaceName>
<reportDate></reportDate>
<testResult></testResult>
<fileLink></fileLink>
<fileName></fileName>
</result>
</results>
</xf:instance>
Later I 'replace' this instance by submission and retrieving information from another xquery:
<xf:submission id="showTable"
method="post"
replace="instance"
ref="instance('table')"
instance="table">
<xf:resource value="concat('/exist/rest/db/xquery/returnTable.xq?interface=',instance('defaultInstance')//InterfaceName,'&','date=',instance('defaultInstance')//CalendarDate)"/>
</xf:submission>
Returned 'table' instance looks like:
<results>
<result>
<interfaceName>test1</interfaceName>
<reportDate>2016-06-01</reportDate>
<testResult>failure</testResult>
<fileLink>http://localhost:8080/exist/rest/db/junitReports/Report2.xml</fileLink>
<fileName>/db/junitReports/Report2.xml</fileName>
</result>
<result>
<interfaceName>test2</interfaceName>
<reportDate>2016-06-01</reportDate>
<testResult>success</testResult>
<fileLink>http://localhost:8080/exist/rest/db/junitReports/Report1.xml</fileLink>
<fileName>/db/junitReports/Report1.xml</fileName>
</result>
</results>
Then I am trying to build a table by referencing values in this returned instance:
<tbody xf:repeat-nodeset="instance('table')//result">
<tr>
<td>
<xf:output ref="interfaceName"></xf:output>
</td>
<td>
<xf:output ref="reportDate"></xf:output>
</td>
<td>
<xf:output ref="testResult"></xf:output>
</td>
<td>
<li>
<!-- <a href="{concat(request:get-scheme(), "://", request:get-server-name(),":", '8080', '/exist/rest', fileLink )}">Link</a> -->
<xf:output ref="fileLink"></xf:output>
</li>
</td>
</tr>
</tbody>
The issue is that the last column should become a clickable link and I did not find a way to do it.
I tried to make a fileLink element in 'table' instance an URL by specifying its type:
<xf:bind nodeset="instance('table')//result/fileLink" type="anyURI"></xf:bind>
But this makes only value in the first row of the table a link. In all next records this column remains a plane text.
I would rather use a simple href (you can see it commented out there), but I do not know how to obtain a value from fileLink element?
This does not work because fileName is not concatenated to the string (I think it is not found):
<a href="{concat(request:get-scheme(), "://", request:get-server-name(),":", '8080', '/exist/rest', fileName)}">Link</a>
and this does not work (which is obvious, but I still tried)
<a href="fileLink">Link</a>
In both possible solution I do not know: How can I refer to fileLink element in pure HTML to get it working with href if I decide to use it (preferable for me solution)? How can I make not only the first occurrence of the field a clickable link, but all the next as well if I use xf:output and xf:bind instead of href?
Thank you.