This is my setup: XML > XSLT > XHTML (using transformNode method)
I want to create forms that pull data from a source XML doc, and displays the resulting data using an XSLT stylesheet. So far, I've created a form that does display the proper data with the <xsl:for-each...> method used, but the data doesn't change on the selections from the form menu.
I realize that I'm likely missing one or more steps, but I'm a complete newbie to XSLT forms, so any help would be greatly appreciated. Any good resources of info on using XSLT forms, especially without the use of scripting, would also be great.
This is what I have so far:
XML doc:
<?xml version="1.0" encoding="UTF-8"?>
<faqs>
<faq>
<category>all</category>
<question>How do I do this?
</question>
<answer>I don't know.</answer>
</faq>
<faq>
<category>option1</category>
<question>How do I do that?
</question>
<answer>I'm not sure.</answer>
</faq>
<faq>
<category>option2</category>
<question>How do I do the other?
</question>
<answer>It depends.</answer>
</faq>
</faqs>
XSLT doc:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:param name="pagepath">http://www.MYSITE.com</xsl:param>
<xsl:param name="selectcategory">all</xsl:param>
<xsl:param name="txtkeyword" />
<xsl:template match="/">
<form name="faqsearch" action="{$pagepath}" method="post">
<table class="navyblueborder" width="100%">
<tr bgcolor="#333366">
<td colspan="2"><h6>Search</h6></td>
</tr>
<tr bgcolor="#9999cc">
<td width="50%"><strong>By Department</strong></td>
<td width="50%"><strong>By Keyword</strong></td>
</tr>
<tr>
<td>
<select name="bydept">
<option value="" selected="true">- Select a Category -</option>
<option value="all">General</option>
<option value="option1">Option1</option>
<option value="option2">Option2</option>
</select>
<input class="button" type="submit" name="submit" />
</td>
<td>
<input type="text" name="bykeyword" />
<input class="button" type="submit" name="submit" />
</td>
</tr>
<tr bgcolor="#9999cc">
<td colspan="2"><strong>Questions</strong></td>
</tr>
<xsl:for-each select="faqs/faq">
<xsl:sort select="question" data-type="text" order="ascending" />
<xsl:if test="category = $selectcategory">
<tr>
<xsl:if test="position() mod 2 != 1">
<xsl:attribute name="style">background-color:#ccccff</xsl:attribute>
</xsl:if>
<td colspan="2"><a href="#"><xsl:value-of select="question" /></a></td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</form>
</div>
</xsl:template>
</xsl:stylesheet>
KWilliams