Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 21st, 2007, 01:12 AM
Registered User
 
Join Date: Jun 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Form Hint buttons help

Hello,

I basically have a XML and XSL file and form and HTML. It will be much easier to explain if you wouldn't mind taking the time to copy and paste the HTML at the bottom into this editor: http://w3schools.com/html/tryit.asp?...ml_form_submit. As you will see I have two buttons next to the bottom two text input fields. What I would like to be able to do is if you hover or click on the button it would show the actually values of the referenced values inside the text field.

Example:
If the input text field contained:
$FIRST_NAME/$MIDDLE_NAME/$LAST_NAME

When you hover or click it would show:
$FIRST_NAME = John
$MIDDLE_NAME = Alan
$LAST_NAME = Doe

Example:
If the input text field contained:
$STREET_NAME_street

When you hover or click it would show:
$STREET_NAME = West Drive

I know in the example you can see the values right above, but this is a simple scenario that I made up. If you had a much large XML file it would be very useful to see what the values represented. I hope that this makes some sense, if not please let me know and I will try and explain things a bit more clear. I thought that Javascript might be the way to do this, but I wasn't sure.

Thanks,

Matt


****XML File*****
Code:
<People>
    <Person>
            <Name id="$FIRST_NAME">John</Name>
            <Name id="$MIDDLE_NAME">Alan</Name>
            <Name id="$LAST_NAME">Doe</Name>
            <Street id="$STREET_NAME">West Drive</Street>
    </Person>

    <Ids>
        <Id id="FullName">$FIRST_NAME/$MIDDLE_NAME/$LASTNAME</Id>
        <Id id="Location">$STREET_NAME_street</Id>
    </Ids>
</People>
*********XSL File**********
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>
    <head>
      <script type="text/javascript">

        //NEED HELP HERE

      </script>
</head>
    <body>
    <table>        
        <xsl:for-each select="//People/Person/Name">
        <tr>
            <td><xsl:value-of select="@id"/>: </td>
            <td>
                <input type="text" size="45">
                    <xsl:attribute name="id">
                        <xsl:value-of select="@id"/>
                    </xsl:attribute>

                    <xsl:attribute name="name">
                        <xsl:value-of select="@id"/>
                    </xsl:attribute>

                    <xsl:attribute name="value">
                        <xsl:value-of select="text()"/>
                    </xsl:attribute>
                </input>
            </td>
        </tr>        
    </xsl:for-each>    
    <xsl:for-each select="//Ids/Id">
        <tr>
            <td><xsl:value-of select="@id"/>: 
            </td>
            <td>
                <input type="text" size="45">
                    <xsl:attribute name="id">
                        <xsl:value-of select="@id"/>
                    </xsl:attribute>

                    <xsl:attribute name="name">
                        <xsl:value-of select="@id"/>
                    </xsl:attribute>

                    <xsl:attribute name="value">
                        <xsl:value-of select="text()"/>
                    </xsl:attribute>
                </input>
            </td>
            <td>
                <input type="button" value="hint"/>
            </td>
        </tr>        
    </xsl:for-each>
    </table>
    </body>
</html>
</xsl:template>
</xsl:stylesheet>
*********HTML*********************
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<head>
<script type="text/javascript">

        //NEED HELP HERE

</script>
</head>
<body>
    <table>
        <tr>
            <td>$FIRST_NAME: </td>
            <td><input type="text" size="45" id="$FIRST_NAME" name="$FIRST_NAME" value="John"/></td>
        </tr>
        <tr>
            <td>$MIDDLE_NAME: </td>
            <td><input type="text" size="45" id="$MIDDLE_NAME" name="$MIDDLE_NAME" value="Alan"/></td>
        </tr>
            <tr><td>$LAST_NAME: </td>
            <td><input type="text" size="45" id="$LAST_NAME" name="$LAST_NAME" value="Doe"/></td>
        </tr>
        <tr>
            <td>FullName: </td>
            <td><input type="text" size="45" id="FullName" name="FullName" value="$FIRST_NAME/$MIDDLE_NAME_$LASTNAME"/></td>
            <td><input type="button" value="hint"/></td></tr>
        <tr>
            <td>Location: </td>
            <td><input type="text" size="45" id="Location" name="Location" value="$STREET_NAME_street"/></td>
            <td><input type="button" value="hint"/>
        </td>
        </tr>
    </table>
</body>
</html>






Similar Threads
Thread Thread Starter Forum Replies Last Post
Buttons disappear from dialog form j0hnyager Visual Basic 2005 Basics 2 March 3rd, 2008 02:24 PM
Form buttons Lofa Beginning PHP 1 March 12th, 2007 06:39 AM
One form.. two submit buttons ashraf_gawdat HTML Code Clinic 1 July 28th, 2006 06:56 PM
Many Buttons on 1 form Mitch HTML Code Clinic 9 October 25th, 2003 12:08 PM





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