Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSL question 1

Status
Not open for further replies.

greedyzebra

Technical User
Sep 5, 2001
140
0
0
US
I'm wanting to turn an xml document into a form page and am wondering how I can apply a default value to a text input field.

Here's how I would do this in HTML:
<input type="text" value="My Default Value">

When displayed in a browser, a text input field would appear with "My Default Value" as the default value.

I can create a text input field with my xsl style sheet like so:

<td><INPUT TYPE="text"/></td>

However I run into problems trying to set the "value" with <xsl:value-of select="XML_TAG_CONTAINING_DEFAULT_DATA"/> as this is meaningless within the HTML tag.

Is there some sort of escape mechanism (escape character) to assign such a value within the HTML tag? Is there any way to do this?

Thanks. If this doesn't make sense, please tell me so I can clarify further.
 
You'll find things a little more robust if you build your HTML using a combination of the <xsl:element> and <xsl:attribute> tags.

Code:
<xsl:element name="input">
 <xsl:attribute name="type">text</xsl:attribute>
 <xsl:attribute name="value">
  <xsl:value-of select="XML_TAG_CONTAINING_DEFAULT_DATA" />
 </xsl:attribute>
</xsl:element>

[sub]Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
[/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top