summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
Diffstat (limited to 'example')
-rw-r--r--example/bugs.sql2
-rw-r--r--example/common.xsl1
-rw-r--r--example/list.xsl21
-rw-r--r--example/view.xsl13
4 files changed, 21 insertions, 16 deletions
diff --git a/example/bugs.sql b/example/bugs.sql
index 033a1f7..eadb89a 100644
--- a/example/bugs.sql
+++ b/example/bugs.sql
@@ -30,7 +30,7 @@ as $$
|| 'where (project like ' || quote_literal('%' || proj || '%')
|| ') and (description like ' || quote_literal('%' || descr || '%')
|| ') order by reported desc limit ' || lim || ' offset ' || offs,
- false, false, 'bugs')
+ false, false, 'urn:x-bugs')
$$ language sql;
-- Now users can be added with select and/or insert privileges,
diff --git a/example/common.xsl b/example/common.xsl
index ff456a3..3a89d46 100644
--- a/example/common.xsl
+++ b/example/common.xsl
@@ -8,6 +8,7 @@
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
+ <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html&gt;</xsl:text>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Bugs</title>
diff --git a/example/list.xsl b/example/list.xsl
index 86c3150..f229e3e 100644
--- a/example/list.xsl
+++ b/example/list.xsl
@@ -2,7 +2,10 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
+ xmlns:bugs="urn:x-bugs"
+ xmlns:str="http://exslt.org/strings"
xmlns="http://www.w3.org/1999/xhtml"
+ extension-element-prefixes="str"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:include href="common.xsl"/>
@@ -11,10 +14,10 @@
<xsl:param name="limit" select="10" />
<xsl:param name="offset" select="0" />
- <xsl:template match="table">
+ <xsl:template match="bugs: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)))">
+ <form method="post" action="view.xhtml?q=insert%20into%20bugs%20(%20:fields%20)%20values%20(%20:values%20)%20returning%20xmlelement(name%20table,xmlattributes('urn:x-bugs'%20as%20xmlns),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>
@@ -70,18 +73,18 @@
<th>Project</th>
<th>Summary</th>
</tr>
- <xsl:for-each select="row">
+ <xsl:for-each select="bugs:row">
<tr>
- <td><xsl:copy-of select="reported/text()" /></td>
- <td><xsl:copy-of select="reporter/text()" /></td>
+ <td><xsl:copy-of select="bugs:reported/text()" /></td>
+ <td><xsl:copy-of select="bugs:reporter/text()" /></td>
<td>
- <a href="list.xhtml?q=select%20bug_search('{project/text()}','',{$limit},{$offset})">
- <xsl:copy-of select="project/text()" />
+ <a href="list.xhtml?q=select%20bug_search(%20q:project%20,'',{$limit},{$offset})&amp;project={str:encode-uri(bugs:project/text(), true())}">
+ <xsl:copy-of select="bugs: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 href="view.xhtml?q=select%20query_to_xml('select%20*%20from%20bugs%20where%20id=''{bugs:id}''',false,false,'urn:x-bugs')">
+ <xsl:copy-of select="bugs:summary/text()" />
</a>
</td>
</tr>
diff --git a/example/view.xsl b/example/view.xsl
index af0e090..84a9d5a 100644
--- a/example/view.xsl
+++ b/example/view.xsl
@@ -2,24 +2,25 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
+ xmlns:bugs="urn:x-bugs"
xmlns="http://www.w3.org/1999/xhtml"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:include href="common.xsl"/>
- <xsl:template match="table/row">
+ <xsl:template match="bugs:table/bugs:row">
<a href="list.xhtml?q=select%20bug_search(%27%27,%20%27%27,%2010,%200)">back to listing</a>
<dl>
<dt>ID</dt>
- <dd><xsl:copy-of select="id/text()" /></dd>
+ <dd><xsl:copy-of select="bugs:id/text()" /></dd>
<dt>Reported</dt>
- <dd><xsl:copy-of select="reported/text()" /></dd>
+ <dd><xsl:copy-of select="bugs:reported/text()" /></dd>
<dt>Reporter</dt>
- <dd><xsl:copy-of select="reporter/text()" /></dd>
+ <dd><xsl:copy-of select="bugs:reporter/text()" /></dd>
<dt>Project</dt>
- <dd><xsl:copy-of select="project/text()" /></dd>
+ <dd><xsl:copy-of select="bugs:project/text()" /></dd>
<dt>Description</dt>
- <dd><pre><xsl:copy-of select="description/text()" /></pre></dd>
+ <dd><pre><xsl:copy-of select="bugs:description/text()" /></pre></dd>
</dl>
</xsl:template>