Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 27th, 2005, 09:52 AM
Banned
Points: 1,561, Level: 16
Points: 1,561, Level: 16 Points: 1,561, Level: 16 Points: 1,561, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2005
Location: , , .
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default Forms with XML > XSLT > XHTML

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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I transform XSLT without the <?xml?> tag? nadavvin XSLT 4 June 10th, 2007 09:25 AM
xslt -> xhtml validation rahulsk1947 XSLT 3 May 17th, 2007 02:54 AM
XML > XSLT and ASP.NET 2.0 bonekrusher XSLT 7 September 22nd, 2006 06:26 PM
2 XML Docs > 1 XSLT Stylesheet kwilliams XSLT 3 September 12th, 2005 11:22 AM
Achitecture ? SQL -> XML -> ASP -> PDF or HTML Frm jstrong Classic ASP XML 0 July 9th, 2005 01:18 PM



All times are GMT -4. The time now is 05:56 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.