Re: Input Fields in XML

Subject: Re: Input Fields in XML
From: anette.engel@xxxxxxxx
Date: Fri, 4 Dec 1998 18:05:21 +0100
Aneel Nazareth wrote the appended text

Do I understand it right:
You are creating an HTML-File including Input Fields from a XML-File
using XSL:
file.xml + file.xsl => file.html with Input Fields

Is there a way of creating an XML-File from a HTML-File containing
Inputfield
and the vlaue of these input fields?

file.html with value in Input Fields => file.xml

Regards
Anette Engel
(just another XSL Newbie)





Aneel Nazareth <anazaret@xxxxxxxxxxxx> on 12/02/98 05:26:44 PM

Please respond to xsl-list@xxxxxxxxxxxxxxxx

To:   xsl-list@xxxxxxxxxxxxxxxx
cc:    (bcc: Anette Engel/crmm)
Subject:  Re: Input Fields in XML




> 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="&lt;CD&gt;
" TYPE="HIDDEN" NAME="xml"/>
<P> Artist: <INPUT VALUE="&lt;ARTIST&gt;" TYPE="HIDDEN" NAME="xml"/>
<INPUT SIZE="60" VALUE=" Peter Gabriel " TYPE="TEXT" NAME="xml"/>
<INPUT VALUE="&lt;/ARTIST&gt;
" TYPE="HIDDEN" NAME="xml"/>
</P>
<P> Album Title: <INPUT VALUE="&lt;TITLE&gt;" TYPE="HIDDEN" NAME="xml"/>
<INPUT SIZE="60" VALUE=" Shaking The Tree: Sixteen Golden Greats "
TYPE="TEXT" NAME="xml"/>
<INPUT VALUE="&lt;/TITLE&gt;
" TYPE="HIDDEN" NAME="xml"/>
</P>
<INPUT VALUE="&lt;/CD&gt;" 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="&#38;lt;CD&#38;gt;
"/>
<xsl:process-children/>
<INPUT TYPE="HIDDEN" NAME="xml" VALUE="&#38;lt;/CD&#38;gt;"/>
<INPUT TYPE="SUBMIT"/>
</FORM>
</BODY>
</:HTML>
</xsl:template>
<xsl:template match="ARTIST" xsl:space="preserve">
<:P>
Artist:
<INPUT TYPE="HIDDEN" NAME="xml" VALUE="&#38;lt;ARTIST&#38;gt;"/>
<INPUT TYPE="TEXT" SIZE="60" NAME="xml" VALUE="{.}"/>
<INPUT TYPE="HIDDEN" NAME="xml" VALUE="&#38;lt;/ARTIST&#38;gt;
"/>
</:P>
</xsl:template>
<xsl:template match="TITLE" xsl:space="preserve">
<:P>
Album Title:
<INPUT TYPE="HIDDEN" NAME="xml" VALUE="&#38;lt;TITLE&#38;gt;"/>
<INPUT TYPE="TEXT" SIZE="60" NAME="xml" VALUE="{.}"/>
<INPUT TYPE="HIDDEN" NAME="xml" VALUE="&#38;lt;/TITLE&#38;gt;
"/>
</:P>
</xsl:template>
</xsl:stylesheet>

 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