Tom, I can see what your javascript would accomplish (exactly what I need).
Would I need to create a var for EACH element that captures user input? or
one that would create the xml_string dynamically using the @name and other
@s of each element? Just wondering...not too strong on javascript...mostly
vb basics...I'm just trying to torture myself with this project!
Again, thank you.
Kathy
-----Original Message-----
From: Passin, Tom [mailto:tpassin(_at_)mitretek(_dot_)org]
Sent: Tuesday, April 22, 2003 2:09 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] I have the XSLT, now need to make it usable as
user-inp ut form?
[Kathy Burke]
My HTML form is created by applying XSLT templates. For
example, a <measure>
element becomes an input box with the @Name applied in the XML. All
templates spring from a simple structure:
<html>
<head></head>
<body>
<xsl:apply-templates />
</body>
</html>
Then I was hoping to just add some vb or javascript to the form as
needed...is it feasible to do it this way?
Yes, very, if I am thinking the same thing as you are.
I write a JavaScript which captures the user's input and
constructs an XML
string (a
well-formed, serialized document, if you will)...
Any way you could show me a bit of an example...?
Here is a javascript function I have used in the past. It can be called
recursively. I did not need attributes in this particular application,
but it would not be hard to add them. It is simple but it produces
well-formed xml unless you work hard to defeat it.
// This function builds a tagged XML element
//with given tag name and content
function element(tag,content){
var xml
if (!content) xml='<'+tag+'/>'
else xml='<'+tag+'>' + content + '</'+tag+'>'
return xml
}
You could write something like
var xml_string = element('measure',
element(name,'Form Element 1'),
'this is a sample form element')
xml_string = element('root',xml_string)
You have to think about whether you need to escape any of the data from
the form elements (which I do not show here).
You could have your stylesheet insert the scriping code into the html
document.
Cheers,
Tom P
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list