summaryrefslogtreecommitdiff
path: root/example/list.xsl
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2018-12-30 13:05:36 +0300
committerdefanor <defanor@uberspace.net>2018-12-30 13:05:36 +0300
commit1b3ea5d48e049c595f90eb8b9fb11f8149927519 (patch)
tree979b85238d5f40f05284993c40b98428ca63a8a8 /example/list.xsl
Initial commit
The initial working version, an example, and brief description are included. Error handling and reporting, perhaps HTTP headers, CLI arguments, and documentation can still be improved, but that's for future commits.
Diffstat (limited to 'example/list.xsl')
-rw-r--r--example/list.xsl92
1 files changed, 92 insertions, 0 deletions
diff --git a/example/list.xsl b/example/list.xsl
new file mode 100644
index 0000000..86c3150
--- /dev/null
+++ b/example/list.xsl
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xhtml="http://www.w3.org/1999/xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+ version="1.0">
+ <xsl:output method="xml" indent="yes"/>
+ <xsl:include href="common.xsl"/>
+ <xsl:param name="project" />
+ <xsl:param name="description" />
+ <xsl:param name="limit" select="10" />
+ <xsl:param name="offset" select="0" />
+
+ <xsl:template match="table">
+ <!-- Report form -->
+ <h2>Report</h2>
+ <form method="post" action="view.xhtml?q=insert%20into%20bugs%20(%20:fields%20)%20values%20(%20:values%20)%20returning%20xmlelement(name%20table,xmlelement(name%20row,xmlelement(name%20id,id),xmlelement(name%20reported,reported),xmlelement(name%20reporter,reporter),xmlelement(name%20project,project),xmlelement(name%20description,description)))">
+ <dl>
+ <dt><label for="report_project">Project</label></dt>
+ <dd>
+ <input type="text" name="project" id="report_project"
+ required="required" maxlength="128"
+ placeholder="Project name or URL" />
+ </dd>
+ <dt><label for="report_description">Description</label></dt>
+ <dd>
+ <textarea name="description" required="required"
+ id="report_description" maxlength="10240"
+ placeholder="Issue description" />
+ </dd>
+ </dl>
+ <input type="submit" value="Report" />
+ </form>
+
+ <!-- Search form -->
+ <h2>Search</h2>
+ <form method="get" action="list.xhtml">
+ <dl>
+ <dt><label for="search_project">Project</label></dt>
+ <dd>
+ <input id="search_project" type="search" name="project"
+ value="{$project}" />
+ </dd>
+ <dt><label for="search_description">Description</label></dt>
+ <dd>
+ <input id="search_description" type="search" name="description"
+ value="{$description}" />
+ </dd>
+ <dt><label for="search_limit">Limit</label></dt>
+ <dd>
+ <input id="search_limit" type="number" name="limit" min="1"
+ value="{$limit}" />
+ </dd>
+ <dt><label for="search_offset">Offset</label></dt>
+ <dd>
+ <input id="search_offset" type="number" name="offset" min="0"
+ value="{$offset}" />
+ </dd>
+ <input type="hidden" name="q"
+ value="select bug_search( q:project , q:description , q:limit , q:offset )" />
+ </dl>
+ <input type="submit" value="Search" />
+ </form>
+
+ <!-- Search results -->
+ <table>
+ <tr>
+ <th>Reported</th>
+ <th>Reporter</th>
+ <th>Project</th>
+ <th>Summary</th>
+ </tr>
+ <xsl:for-each select="row">
+ <tr>
+ <td><xsl:copy-of select="reported/text()" /></td>
+ <td><xsl:copy-of select="reporter/text()" /></td>
+ <td>
+ <a href="list.xhtml?q=select%20bug_search('{project/text()}','',{$limit},{$offset})">
+ <xsl:copy-of select="project/text()" />
+ </a>
+ </td>
+ <td>
+ <a href="view.xhtml?q=select%20query_to_xml('select%20*%20from%20bugs%20where%20id=''{id}''',false,false,'foo')">
+ <xsl:copy-of select="summary/text()" />
+ </a>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </xsl:template>
+
+</xsl:stylesheet>