Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
| 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
Closed Thread
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 12th, 2004, 07:20 AM
Registered User
Join Date: Apr 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSLT Help for a beginner

Hey guys,

I'm in desperate need for help! Isn't everyone that post though :)

Ok. I'm really new to XSLT so I'm guessing the problem I'm having is easily overcome... I hope cos I need to get this thing finished in about 5 hours. Everything is working on my webpage except for one thing... I need to add a button in the XSLT. The code supplied works fine except for the button section. It displays all the products, descriptions,etc... What I need as well, is to have a button for each product that has the following code attached to it

Context.Items("ProductID") = @name
                             (the name of the current product name)

So it calls the addtocart page and the code in that adds the product to the shopping cart.

Ok, in the code below, I've tried heaps of things to get this working but I just can't figure it out.

Guys, any help here ASAP would be greatly appreciated! I'm a the business end of the rope at the moment so I'm really struggling. :(

Look forward to a solution.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version= "1.0">
    <xsl:template match="/">

        <xsl:for-each select="/productlist/product">
            <TABLE width="75%" align="center" border="1">
                    <td>Name: </td>
                    <td><xsl:apply-templates select="name"/></td>
                    <td RowSpan = "4" width= "0"> <xsl:apply-templates select="image"/></td>
                    <td>Code: </td>
                    <td><xsl:apply-templates select="code"/>t</td>
                    <td>Category: </td>
                    <td><xsl:apply-templates select="category"/></td>
                    <td>Price: </td>
                    <td><xsl:apply-templates select="price"/></td>
                    <td>Description: </td>
                    <td><xsl:apply-templates select="description"/></td>
                        <input type="button" onclick="Context.Items("ProductID") = prodid;Server.Transfer("AddToCart.aspx")" value="Add To Cart"/>

    <xsl:template match="name">
        <b><xsl:value-of select="."/> </b>

    <xsl:template match="code">
        <xsl:value-of select="."/>

    <xsl:template match="price">
        $<xsl:value-of select="."/>.00

    <xsl:template match="category">
        <xsl:value-of select="."/>

    <xsl:template match="description">
        <xsl:value-of select="."/>

    <xsl:template match="image">
            <xsl:attribute name="src">
                <xsl:value-of select="." />


Closed Thread

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
xslt beginner question cfflexguy XSLT 4 October 16th, 2007 09:11 AM
dynamic xslt -> xslt creation namespace problem jkmyoung XSLT 2 July 15th, 2006 12:42 AM
XSLT Beginner Issues faberd XSLT 2 March 21st, 2006 02:22 PM
beginner xslt processor question randallxski XSLT 3 March 24th, 2005 09:41 AM
Beginner Tilak_1 C# 2 January 21st, 2005 11:19 PM

All times are GMT -4. The time now is 02:38 PM.

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