Re: Slightly OT XSTL StyleSheet for html form
| From: | Lars Olsson | Date: | Wed, 07 Aug 2002 09:20:50 +0000 |
| Subject: | Re: Slightly OT XSTL StyleSheet for html form | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-111481@lists.php.net to get a copy of this message | ||
Hi!
Im no XSLT expert, but you could try using <xsl:attribute>...something like the code below (totally untested)
<input>
<xsl:attribute name="type">
text
<xsl:attribute>
<xsl:attribute name="name">
FirstName
<xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of-select="customer/FirstName"/>
<xsl:attribute>
</input>
Kindly
/lasso (lasso@lassoweb.nu)
Geoff Hankerson wrote:
Not really a direct php question but I am trying to build an XSLT stlyeshet
to convert an xml file (or string) into an html form to allow editing.
Given this (simplified) xml:
<customer>
<CustomerID>78952157</CustomerID>
<FirstName>John</FirstName>
<MiddleInit />
<LastName>Doe</LastName>
<Firm>Doe& Doe, P.A.</Firm>
</customer>
I want to convert to this to the following html
<form>
<table WIDTH="662" BORDER="1" CELLPADDING="0" CELLSPACING="0">
<tr>
<td valign="top" align="right" width="200">
First Name
</td>
<td valign="top" width="462">
<input type='text' name='FirstName' value='John' />
</td>
</tr>
</table>
</form>
So I can get the firstname value in the xsl stylesheet by using:
<xsl:value-of select="customer/FirstName"/>
but how do I jam it into value part of <input type='text' name='FirstName'
value='' />
without creating badly formed xml? Only way I can think of doing is using:
<textarea><xsl:value-of select="customer/FirstName"/></textarea> but this
isn't such a great solution