Subject: Re: Input Fields in XML From: Aneel Nazareth <anazaret@xxxxxxxxxxxx> Date: Wed, 02 Dec 1998 11:26:44 -0500 |
> does anyone has an idea to generate an XML-File that contains the > Input.Value from an HTML Input Field? I've played around with this a little bit, and been pretty successful with just encoding the entire XML document in the HTML document. I've used XSL stylesheets to write the HTML pages directly from the XML. This has the benefit of being easy and the drawback of being big. Add some storage mechanism, and <poof/>! instant web database! (Ok, there are some other pieces...) I've added a sample below of the HTML, the XML, and the XSL. If you look at the XSL, you'll notice that the two different fields require two different rules to create. This would not be the case if there were a standard XSL mechanism for extracting the names of tags. Caveats: there's a piece missing here, the CGI backend. I'm using a Java servlet that just concatenates the contents of the "xml" CGI parameter together and runs it through the XSL styler, but your CGI engine may deal differently with multiple values with the same name (Like concatenate with commas, for example). Also, I've only tested this stylesheet with my own XSL processor. If you're using XT or Koala or something YMMV. HTML PAGE <HTML><HEAD> <TITLE>XSL Form Styler</TITLE> </HEAD><BODY> <FORM METHOD="POST" ACTION=" the action goes here... "> <H1>CD Collection: Disc View</H1> <INPUT VALUE="<CD> " TYPE="HIDDEN" NAME="xml"/> <P> Artist: <INPUT VALUE="<ARTIST>" TYPE="HIDDEN" NAME="xml"/> <INPUT SIZE="60" VALUE=" Peter Gabriel " TYPE="TEXT" NAME="xml"/> <INPUT VALUE="</ARTIST> " TYPE="HIDDEN" NAME="xml"/> </P> <P> Album Title: <INPUT VALUE="<TITLE>" TYPE="HIDDEN" NAME="xml"/> <INPUT SIZE="60" VALUE=" Shaking The Tree: Sixteen Golden Greats " TYPE="TEXT" NAME="xml"/> <INPUT VALUE="</TITLE> " TYPE="HIDDEN" NAME="xml"/> </P> <INPUT VALUE="</CD>" TYPE="HIDDEN" NAME="xml"/> <INPUT TYPE="SUBMIT"/> </FORM> </BODY> </HTML> XML RESULT <CD> <ARTIST> Peter Gabriel </ARTIST><TITLE> Shaking The Tree: Sixteen Golden Greats </TITLE></CD> STYLESHEET <INPUT TYPE="TEXT" SIZE="60" NAME="style" VALUE="http://ace.dcm.com:8080/anazaret/cd.xsl"/> </P> <H1>CD Collection: Disc View</H1> <INPUT TYPE="HIDDEN" NAME="xml" VALUE="&lt;CD&gt; "/> <xsl:process-children/> <INPUT TYPE="HIDDEN" NAME="xml" VALUE="&lt;/CD&gt;"/> <INPUT TYPE="SUBMIT"/> </FORM> </BODY> </:HTML> </xsl:template> <xsl:template match="ARTIST" xsl:space="preserve"> <:P> Artist: <INPUT TYPE="HIDDEN" NAME="xml" VALUE="&lt;ARTIST&gt;"/> <INPUT TYPE="TEXT" SIZE="60" NAME="xml" VALUE="{.}"/> <INPUT TYPE="HIDDEN" NAME="xml" VALUE="&lt;/ARTIST&gt; "/> </:P> </xsl:template> <xsl:template match="TITLE" xsl:space="preserve"> <:P> Album Title: <INPUT TYPE="HIDDEN" NAME="xml" VALUE="&lt;TITLE&gt;"/> <INPUT TYPE="TEXT" SIZE="60" NAME="xml" VALUE="{.}"/> <INPUT TYPE="HIDDEN" NAME="xml" VALUE="&lt;/TITLE&gt; "/> </:P> </xsl:template> </xsl:stylesheet> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Input Fields in XML, Bernd . Loepmeier | Thread | Re: Input Fields in XML, Aneel Nazareth |
Newbie: How to write a stylesheet t, Francois Belanger | Date | Re: navigating through recursive de, Steve Muench |
Month |