Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 9th, 2005, 08:14 AM
Registered User
 
Join Date: Dec 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Write XML element into textbox with XSLT

Hi, I'm using XSLT to format an XML document but I want to write some of the XML into HTML form controls. For example, I'd like a textbox to contain the data from one of the XML elements. It won't let me do this...

Code:
<input type="text" id="whatever" value="<xsl:value-of select="RESPONSE"/>" />
...so is there a correct way to achieve this?

Thanks.
 
Old December 9th, 2005, 08:51 AM
Registered User
 
Join Date: Dec 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i think this should do it

<input type="text" id="whatever">
  <xsl:attribute name="value">
    <xsl:value-of select="RESPONSE"/>
  </xsl:attribute>
</input>

 
Old December 9th, 2005, 09:53 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Or use the shorter "attribute value template" method:
Code:
<input type="text" id="whatever" value="{RESPONSE}" />
Not all attributes accept the curly brace substitution though, it won't work for dynamic includes in xsl:include or the match on an xsl:template for example.

--

Joe (Microsoft MVP - XML)
 
Old July 5th, 2006, 02:47 AM
Registered User
 
Join Date: Sep 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok after I show it to the textbox, and the user modify it. Is it possible to write it back to the xml file ?

Any idea on how to do it.

Any help will be very much appreciated.
Thank you

 
Old July 5th, 2006, 04:08 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I'm not sure where "the XML file" is. On the server?

Take a look at XForms for this: but htere's a lot of new technology to learn.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
XML element with delimited values and XSLT Clark Kent XSLT 15 May 7th, 2008 10:10 AM
Popup cannot write int parentwindow textbox greatJ .NET Framework 2.0 0 August 13th, 2007 02:35 AM
write the values of textbox to a file sandhyamn Pro JSP 1 May 23rd, 2007 10:04 AM
hi help me to write javascript to validate textbox karthikc85 XML 1 October 12th, 2006 03:12 AM
How to write value of checked list in textbox gilgalbiblewheel Classic ASP Databases 2 August 10th, 2005 06:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.