Hoi peoples,
Hoe krijg je user-input, bijv. uit <INPUT type="text" name="zoek">, in XSL variable $zoek?
Het stukje waar het om gaat:
Hoe krijg je user-input, bijv. uit <INPUT type="text" name="zoek">, in XSL variable $zoek?
Het stukje waar het om gaat:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
| <?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" />
<xsl:template match="/">
<html><head><title>Online Documentatie Archief</title></head>
<body>
<!-- STOP HIER (ter plaatse van deze regel) DE USER-INPUT IN VARIABLE $zoek -->
<span>Er wordt gezocht op: <xsl:value-of select="$zoek" /></span>
<!-- start tabel -->
<table border="0" width="765" cellpadding="4">
<xsl:for-each select="/catalogus/item">
<xsl:variable name="hit" select="trefwoord" />
<!-- check of tussen de trefwoorden het gezochte woord zit -->
<xsl:if test="contains($hit,$zoek)">
<!-- als er een hit is, dan de titel weergeven met overige info -->
<tr>
<td>
<span><xsl:value-of select="@id" />
: <b><xsl:value-of select="titel" /></b></span><br />
<span><xsl:value-of select="beschrijving" /></span><br />
<span><i>door: <xsl:value-of select="auteur" /></i><br />
<i>copyright: <xsl:value-of select="copyright" /></i><br /></span>
</td>
<td>[img]"{@id}.gif"[/img]</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
<!-- EOF -->
</body></html>
</xsl:template></xsl:stylesheet> |
[Hier had mijn handtekening kunnen staan]