Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 14-01-2009
Member
 
Join Date: Oct 2008
Posts: 54
Code for returning the QueryString

The three files given below must be kept in same folder. The file controls.xml must be opened in browser.
The output will be the form generated through xslt. When user clicks on submit the file process.htm retrieves the querystring portion.

XML File : controls.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>

<?xml-stylesheet type="text/xsl" href="Controls.xsl"?>

<FORM NAME="REGISTRTION" ACTION="process.htm" METHOD="GET">

<CONTROL NAME="txtLoginName" LABEL="Login Name" TYPE="text" VALUE="" BREAK="Yes"/>

<CONTROL NAME="txtPassword" LABEL="Password" TYPE="password" VALUE="" BREAK="Yes"/>

<CONTROL NAME="rdoGender" LABEL="Male" TYPE="radio" VALUE="M"/>
<CONTROL NAME="rdoGender" LABEL="Female" TYPE="radio" VALUE="F" BREAK="Yes"/>

<CONTROL NAME="optOccupation" LABEL="Occupation" TYPE="LIST" VALUE="" BREAK="Yes">
<LISTITEM VALUE="DR" TEXT="DOCTOR"/>
<LISTITEM VALUE="ER" TEXT="ENGINEER"/>
<LISTITEM VALUE="IT" TEXT="IT PROFESSIONAL"/>
<LISTITEM VALUE="OT" TEXT="OTHERS"/>
</CONTROL>

<CONTROL BREAK="Yes"/>

<CONTROL NAME="cmdSubmit" LABEL="Submit Form" TYPE="SUBMIT" VALUE="SUBMIT"/>
<CONTROL NAME="cmdReset" LABEL="Reset Form" TYPE="RESET" VALUE="CLEAR" BREAK="Yes"/>

</FORM>
xsl file : controls.xsl

Code:
<?xml version="1.0" encoding="UTF-8"?>

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

<xsl:template match="*">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="text()">
<xsl:value-of select="."/>
</xsl:template>

<xsl:template match="/">
<FORM>
<xsl:attribute name="NAME"><xsl:value-of select="FORM/@NAME"/></xsl:attribute>
<xsl:attribute name="ACTION"><xsl:value-of select="FORM/@ACTION"/></xsl:attribute>
<xsl:attribute name="METHOD"><xsl:value-of select="FORM/@METHOD"/></xsl:attribute>

<xsl:for-each select="FORM/CONTROL">
<SPAN style="font-family:Tahoma;margin-right:10"><xsl:value-of select="@LABEL"/></SPAN>

<xsl:choose>
<xsl:when test="@TYPE [. = 'LIST']">
<SELECT style="font-weight:bold;font-family:tahoma;font-size:11">
<xsl:attribute name="NAME"><xsl:value-of select="@NAME"/></xsl:attribute>
<xsl:for-each select="LISTITEM ">
<OPTION>
<xsl:attribute name="VALUE"><xsl:value-of select="@VALUE"/></xsl:attribute>
<xsl:value-of select="@TEXT"/>
</OPTION>
</xsl:for-each>
</SELECT>
</xsl:when>
<xsl:otherwise>
<xsl:if test="@TYPE [. != '']">
<INPUT style="margin-right:20">
<xsl:attribute name="NAME"><xsl:value-of select="@NAME"/></xsl:attribute>
<xsl:attribute name="TYPE"><xsl:value-of select="@TYPE"/></xsl:attribute>
<xsl:attribute name="VALUE"><xsl:value-of select="@VALUE"/></xsl:attribute>
</INPUT>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@BREAK [. = 'Yes']">
<BR/>
</xsl:if>
</xsl:for-each>
</FORM>
</xsl:template>

</xsl:stylesheet>
Reply With Quote
  #2  
Old 14-01-2009
Member
 
Join Date: Oct 2008
Posts: 54
Re: Code for returning the QueryString

htm file : process.htm

Code:
</HEAD>
<BODY style="font-family:arial">


<SCRIPT LANGUAGE="JavaScript">
<!--

var queryString = window.document.location.href;
var pos = parseInt(queryString.indexOf("?")) + 1;
var length = queryString.length;
document.write(queryString.substring(pos,length));

//-->
</SCRIPT>

</BODY>
</HTML>
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Code for returning the QueryString"
Thread Thread Starter Forum Replies Last Post
Confuse about to keep or returning my PS3 Iquau Portable Devices 10 11-09-2011 10:49 PM
Erase an SSD before returning it ADALBERTO Portable Devices 6 03-07-2010 06:06 AM
Erase an SSD before returning it Chen Operating Systems 6 03-07-2010 04:01 AM
How to enable ASP encrypt querystring with website page Suzane Software Development 3 04-08-2009 11:42 AM
QueryString parameter OnAfterLogin PEI Ramsey Software Development 5 04-11-2008 06:31 PM


All times are GMT +5.5. The time now is 11:03 AM.