Re: [xsl] Creating an input form, XML -> XSLT -> HTML

Subject: Re: [xsl] Creating an input form, XML -> XSLT -> HTML
From: "Robert Koberg" <rob@xxxxxxxxxx>
Date: Sat, 29 Dec 2001 18:39:50 -0800
I am still not sure what you are trying to do but I don't think you are
looking at it in the right way. First, I believe you need an ID attribute
instead of (in addition to) the NAME attribute.  You will probably want to
get Mike Kay's XSLT book.  You need to look up attribute value templates:

<xsl:variable name="id" select="generate-id()"/>

First Name:
<input
    type="text"
    name="{$id}"
    id="{$id}"
    value="{GivenName}"/>

best,
-Rob

----- Original Message -----
From: "Ron King" <roncking@xxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Saturday, December 29, 2001 3:04 PM
Subject: Re: [xsl] Creating an input form, XML -> XSLT -> HTML


> I was able to use xslt like this:
>
> <xsl:text disable-output-escaping="yes"> First Name: <![CDATA[<]]>input
> type="text" name="</xsl:text><xsl:value-of
> select="generate-id()"/><xsl:text>" value="</xsl:text><xsl:value-of
> select="GivenName"/><xsl:text disable-output-escaping="yes">"> </xsl:text>
>
> To get this:
>
> First Name: <input type="text" name="N40003D" value="Jane">
>
> This is valid input in an HTML form. These names occur at multiple levels,
so
> it takes a different xpath expression to reach them. Ultimately I have to
be
> able to associate the field name, "N40003D" to the xpath that would find
the
> element in a DOM object, so that I may update it. If I can somehow figure
out
> how to use xslt to get a string representing the xpath to the element, I
> could use JSP to build a HashTable of the name-value pairs. How can I get
a
> string representing the path in xslt?
>
>
> Robert Koberg wrote:
>
> > what is your xml and what xslt have you tried? perhaps you are having
> > problems with attribute-value-templates:
> >
> > <INPUT NAME={@name} ..etc..>
> >
> > ----- Original Message -----
> > From: "Ron King" <roncking@xxxxxxxx>
> > To: <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>
> > Sent: Saturday, December 29, 2001 12:01 PM
> > Subject: [xsl] Creating an input form, XML -> XSLT -> HTML
> >
> > > Hi,
> > >
> > > I want to take XML and generate an input form using XSLT. In straight
> > > HTML, I would code this:
> > >
> > > <INPUT TYPE = "TEXT" NAME="FIRSTNAME" VALUE="JAMES" >
> > >
> > > My XML documents may have multiple occurances of names, so I can't
> > > hardcode "FIRSTNAME".  I need to dynmically generate the NAME using
> > > generate-id(), right? I also would like to be able to generate a
string
> > > that is the xpath representation of the XML data.
> > >
> > > My overall goal is to be able to identify the field name, and the
xpath
> > > to the field so that I can process the results of the HTTP Request
when
> > > it comes back from the browser using JXPATH, a tool for accessing java
> > > beans with the xpath syntax , understand.
> > >
> > > I've tried to code this, but I can't figure out how to do it! Please
> > > help me.
> > >
> > > Regards,
> > >
> > > Ron
> > >
> > >
> > >
> > >
> > >  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> >
> >  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>
>  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