How to display XML content in Text Field?
I want to have a XSL file to pick up the content of the XML file and fill it to an Input Text Field.
The following is my XML file: -
Profile.XML
--
<table>
<CompanyProfile>
<Name>ABC, Incorp</Name>
</CompanyProfile>
</table>
In my XSL file, the value of Name will be displayed in the text field
E.g. in my XSL file I have: -
<input type="text" name="NameText" size="50" maxlength="50" />
How do I insert the following into the field?
<xsl:value-of select="table/CompanyProfile/Name"/>
[632 byte] By [
kttan] at [2007-9-26 1:27:48]

> I want to have a XSL file to pick up the content of
> the XML file and fill it to an Input Text Field.
>
> The following is my XML file: -
> Profile.XML
> --
> <table>
> <CompanyProfile>
> <Name>ABC, Incorp</Name>
> </CompanyProfile>
> </table>
>
> In my XSL file, the value of Name will be displayed in
> the text field
> E.g. in my XSL file I have: -
> <input type="text" name="NameText" size="50"
> maxlength="50" />
>
> How do I insert the following into the field?
> <xsl:value-of select="table/CompanyProfile/Name"/>
I think this is how you would do it. Use xsl:attribute to add an attribute to your input tag.
<xsl:template match="foo">
<input>
<xsl:attribute name="name">
<xsl:value-of select="table/CompanyProfile/Name" />
</xsl:attribute>
</input>
</xsl:template>
This should add an attribute to the <input> tag named "name" with a value determined by the xsl:value-of statement.
Assuming your XPath value is correct, the result would be:
<input name="ABC, Incorp">
Hope this helps.
Mike W.