[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Can u program XML in javascript?

Subject: RE: Can u program XML in javascript?
From: Heather Lindsay <heather.lindsay@xxxxxxxxxxxxx>
Date: Mon, 8 Jan 2001 13:36:59 -0500
heather rosa
<xsl:stylesheet ..... >
<xsl:template match="/">
<HTML>
<HEAD>
	<script language="Javascript">
	function getDate(){
		// myCompare is set to be QuestionCheck's value attribute
		var myCompare = '<xsl:value-of
select="QuestionDefs/QuestionCheck/@Value"/>'
		// entered is set to be the value entered in the text field
		var entered = document.all.dDate.value;
		// compare the two values here in an if statement and do
necessary processing
	}	
	</script>
</HEAD>
<BODY>
	other stuff here
	<xsl:apply-templates select="dummy"/>
	other stuff here 
</BODY>
</HTML>
</xsl:template>
<xsl:template match="dummy">
<CENTER><INPUT type="text" name="dDate" onChange="getDate()"/><BR/><BR/>
<INPUT type="button" name="Calendar" value="Calendar" id="ButCal"
onClick="calClick()"/>
</CENTER>
</xsl:template>
</xsl:stylesheet>

This should help get you started if I'm understanding what you're asking
correctly.

Good luck,
Heather





Rosa wrote:
Can anyone please tell me whether I can access certain nodes in the XML when
I'm programming javascript in it?  
This is what I'm doing:
this is the XML:
      <QuestionDefs>
        <QuestionDef Category="Travel" Id= "departure_date" Caption="What is
your departure date?" Style="Date" Required="Quote">
          <QuestionCheck Value=">Today" Message="Return date must be after
today"/>
        </QuestionDef>
      </QuestionDefs>

this is the XSL template:
<xsl:template match="dummy">
<CENTER><INPUT type="text" name="dDate" onChange="getDate()"/><BR/><BR/>
<INPUT type="button" name="Calendar" value="Calendar" id="ButCal"
onClick="calClick()"/>
</CENTER>
</xsl:template>

when I type in the date (onChange) I want the javascript to compare this
value to the QuestionCheck's Value attribute, and then if that's true, I
will show the message attribute.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.