summaryrefslogtreecommitdiff
path: root/example/list.xsl
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2019-02-03 21:42:35 +0300
committerdefanor <defanor@uberspace.net>2019-02-03 21:42:35 +0300
commit83a90895a5b6f1267ad272bfe23a6b604068d3c0 (patch)
tree8e9e59ac917c53a7c1921e6fcee14c35a7d0cae4 /example/list.xsl
parent7bc223ad6408a36072b5196fbf0dcc7de15b0984 (diff)
Replace HXT with libxml
The primary issue is that str:encode-uri function from EXSLT is not available with HXT (but available with libxml's friends: libxslt and libexslt, which are generally more complete). This function is important for HTML documents. Another reason is libxml being better documented and somewhat easier to work with. Yet another reason to switch is the intent to avoid dependencies that reimplement common functionality, and/or normally get statically linked.
Diffstat (limited to 'example/list.xsl')
-rw-r--r--example/list.xsl21
1 files changed, 12 insertions, 9 deletions
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>