[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Applying XSL and Javascript to XMLDOMNode objects


Subject: Applying XSL and Javascript to XMLDOMNode objects
From: ClareEvans@xxxxxxxxxxxxx
Date: Wed, 23 Feb 2000 19:18:00 -0000

Scenario: creating an on-line form on the fly from datastore using XML and
XSL

Exert from XML I am working with to dynamically create form is:

<RECORD>
	<INTRODUCTION>Please complete all sections of the form before
submitting</INTRODUCTION>
	<SECTIONNAME>User Details</SECTIONNAME>
	<QUESTION>Name</QUESTION>
	<ANSWERTYPE>text</ANSWERTYPE>
	<DESCRIPTION></DESCRIPTION>
	<VALIDATION>Required</VALIDATION>
</RECORD>
<RECORD>
	<INTRODUCTION>Please complete all sections of the form before
submitting</INTRODUCTION>
	<SECTIONNAME>User Details</SECTIONNAME>
	<QUESTION>Department</QUESTION>
	<ANSWERTYPE>radio</ANSWERTYPE>
	<DESCRIPTION>Information Systems</DESCRIPTION>
	<VALIDATION>Required</VALIDATION>
</RECORD>

Exert from XSL record template for this particular section is as follows:

<xsl:when match=".//ANSWERTYPE[.='text']">
	<input >
		<xsl:attribute
name="class"><xsl:eval>funcValidation(this)</xsl:eval></xsl:attribute>
		<xsl:attribute name="id"><xsl:value-of
select="."/></xsl:attribute>
		<xsl:attribute name="type"><xsl:value-of
select="."/></xsl:attribute>
	</input>
</xsl:when>

Problem: need to write a JavaScript function ( as referenced above at
funcValidation) called locally when parsing the <ANSWERTYPE> element.
Function will assign the value of <VALIDATION> to the class attribute of the
<input> tag.

However using Javascript how the heckas can I do this at run-time (using
IE4)?

Beer to the man that can.

Clare

 02/23/00 19:18:05
------------------------------------------------------------------------------
Part of the Halifax Group, Halifax Group plc, Registered in England No. 2367076.  Registered Office: Trinity Road, Halifax, West Yorkshire HX1 2RG. Represents only the Halifax Financial Services Marketing Group for the purposes of advising on and selling life assurance, pensions and unit trust business.  The Marketing Group is regulated by the Personal Investment Authority.  Switchboard 01422 333333.


==============================================================================


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



Current Thread
Keywords