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

RE: I have the XSLT, now need to make it usable asuser

Subject: RE: I have the XSLT, now need to make it usable asuser-inp ut form?
From: "Kathy Burke" <Kathy_Burke@xxxxxxxxx>
Date: Tue, 22 Apr 2003 14:34:04 -0400
xml tag b
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@xxxxxxxxxxxx]
Sent: Tuesday, April 22, 2003 2:09 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  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


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.