diff options
author | randomdan <randomdan@localhost> | 2010-07-02 14:51:46 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2010-07-02 14:51:46 +0000 |
commit | 3aac30e9ce08944526bdceefa4f5ec56bf5542f9 (patch) | |
tree | f94a3db761f091499786d88d7f0b739d6b1bd354 | |
parent | Implement login and logout and generic forms (diff) | |
download | gentoobrowse-3aac30e9ce08944526bdceefa4f5ec56bf5542f9.tar.bz2 gentoobrowse-3aac30e9ce08944526bdceefa4f5ec56bf5542f9.tar.xz gentoobrowse-3aac30e9ce08944526bdceefa4f5ec56bf5542f9.zip |
Make form a shared stylesheet and use it for the search too
-rw-r--r-- | gentoobrowse/form.xslt | 41 | ||||
-rw-r--r-- | gentoobrowse/login.xslt | 35 | ||||
-rw-r--r-- | gentoobrowse/present/search.xml | 9 | ||||
-rw-r--r-- | gentoobrowse/search.xslt | 13 |
4 files changed, 53 insertions, 45 deletions
diff --git a/gentoobrowse/form.xslt b/gentoobrowse/form.xslt new file mode 100644 index 0000000..7e55b0f --- /dev/null +++ b/gentoobrowse/form.xslt @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:project2="http://project2.randomdan.homeip.net/" exclude-result-prefixes="project2" + xmlns:dyn="http://exslt.org/dynamic" extension-element-prefixes="dyn"> + <xsl:import href="base.xslt" /> + <xsl:template match="para"> + <xsl:copy-of select="." /> + </xsl:template> + <xsl:template match="form"> + <form class="generalForm"> + <xsl:attribute name="action"><xsl:value-of select="@action" /></xsl:attribute> + <xsl:attribute name="method"><xsl:value-of select="@method" /></xsl:attribute> + <h2><xsl:value-of select="@caption" /></h2> + <table> + <xsl:for-each select="input"> + <tr> + <th><xsl:value-of select="@caption" /></th> + <td> + <input> + <xsl:attribute name="type"><xsl:value-of select="@type" /></xsl:attribute> + <xsl:attribute name="name"><xsl:value-of select="@name" /></xsl:attribute> + <xsl:attribute name="value"> + <xsl:value-of select="dyn:evaluate(@xslvalue)" /> + </xsl:attribute> + <xsl:attribute name="autocomplete"><xsl:value-of select="@auto" /></xsl:attribute> + </input> + </td> + </tr> + </xsl:for-each> + <tr> + <th colspan="2" align="right"> + <input type="submit"> + <xsl:attribute name="value"><xsl:value-of select="@submit" /></xsl:attribute> + </input> + </th> + </tr> + </table> + </form> + </xsl:template> +</xsl:stylesheet> + diff --git a/gentoobrowse/login.xslt b/gentoobrowse/login.xslt index 26dea0e..7849fe4 100644 --- a/gentoobrowse/login.xslt +++ b/gentoobrowse/login.xslt @@ -3,44 +3,11 @@ xmlns:project2="http://project2.randomdan.homeip.net/" exclude-result-prefixes="project2" xmlns:dyn="http://exslt.org/dynamic" extension-element-prefixes="dyn"> <xsl:import href="base.xslt" /> + <xsl:import href="form.xslt" /> <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" doctype-system="http://www.w3.org/TR/html4/loose.dtd" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" /> <xsl:template name="content"> <xsl:apply-templates select="form|para" /> </xsl:template> - <xsl:template match="para"> - <xsl:copy-of select="." /> - </xsl:template> - <xsl:template match="form"> - <form class="generalForm"> - <xsl:attribute name="action"><xsl:value-of select="@action" /></xsl:attribute> - <xsl:attribute name="method"><xsl:value-of select="@method" /></xsl:attribute> - <h2><xsl:value-of select="@caption" /></h2> - <table> - <xsl:for-each select="input"> - <tr> - <th><xsl:value-of select="@caption" /></th> - <td> - <input> - <xsl:attribute name="type"><xsl:value-of select="@type" /></xsl:attribute> - <xsl:attribute name="name"><xsl:value-of select="@name" /></xsl:attribute> - <xsl:attribute name="value"> - <xsl:value-of select="dyn:evaluate(@xslvalue)" /> - </xsl:attribute> - <xsl:attribute name="autocomplete"><xsl:value-of select="@auto" /></xsl:attribute> - </input> - </td> - </tr> - </xsl:for-each> - <tr> - <th colspan="2" align="right"> - <input type="submit"> - <xsl:attribute name="value"><xsl:value-of select="@submit" /></xsl:attribute> - </input> - </th> - </tr> - </table> - </form> - </xsl:template> </xsl:stylesheet> diff --git a/gentoobrowse/present/search.xml b/gentoobrowse/present/search.xml index 26c7c1d..716dc07 100644 --- a/gentoobrowse/present/search.xml +++ b/gentoobrowse/present/search.xml @@ -1,4 +1,11 @@ <?xml version="1.0"?> -<view name="search" root="gentoo" style="search.xslt" xmlns:xi="http://www.w3.org/2001/XInclude"> +<view name="search" root="gentoo" style="search.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:project2="http://project2.randomdan.homeip.net"> + <project2:rawview> + <form caption="Search" submit="Search" action="/search" method="get"> + <input type="text" caption="Criteria" name="criteria" + xslvalue="/gentoo/project2:params/project2:param[@name='criteria']" /> + </form> + </project2:rawview> <xi:include href="../views/search.xml" /> </view> diff --git a/gentoobrowse/search.xslt b/gentoobrowse/search.xslt index ec8f9dd..6a8fd50 100644 --- a/gentoobrowse/search.xslt +++ b/gentoobrowse/search.xslt @@ -2,25 +2,18 @@ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:project2="http://project2.randomdan.homeip.net/" exclude-result-prefixes="project2" > <xsl:import href="base.xslt" /> + <xsl:import href="form.xslt" /> <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" doctype-system="http://www.w3.org/TR/html4/loose.dtd" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" /> <xsl:template name="content"> - <h2>Search</h2> - <form action="/search" method="get"> - <input type="text" name="criteria"> - <xsl:attribute name="value"> - <xsl:value-of select="/gentoo/project2:params/project2:param[@name='criteria']" /> - </xsl:attribute> - </input> - <input type="submit" /> - </form> + <xsl:apply-templates select="form|para" /> <xsl:apply-templates select="/gentoo/searchResults" /> </xsl:template> <xsl:template match="/gentoo/searchResults"> <xsl:if test="/gentoo/project2:params/project2:param[@name='criteria'] != ''"> <xsl:if test="count(/gentoo/searchResults/package) > 0"> - <h2>Search Results</h2> + <h2>Search Results for "<xsl:value-of select="/gentoo/project2:params/project2:param[@name='criteria']"/>"</h2> <ul> <xsl:apply-templates select="/gentoo/searchResults/package" /> </ul> |