Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    NYC
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Filling a textbox with an xsl stylesheet

    I'm trying to generate a form with pre-existing values in the text boxes. For example:

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

    This works fine if I'm trying to use the field to create a name attribute. But the textboxes are recording no value when they appear in the page. Anyone know how I should be approaching this?

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    <input type="text" name="firstname" value="{firstname}"/>

    You should be able to use the attribute shortcut there.

  • #3
    New Coder
    Join Date
    Jun 2002
    Location
    NYC
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the quick reply.

    It appears that there is something else wrong; whatever was blocking the data with my original set up is still blocking it with your revision.

    I'm definitely genereating information out of the servlet, and the code that produces the XML stream is the same that is used successfully in previous servlets within the same package. When I "view Source", the XML code is correct. But the elements are simply not registering as textbox values.

  • #4
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    It should work.

    Which version of MSXML, or which Mozilla build, are you using to view this? Because I see absolutely no reason why the value attribute shouldn't be filled in with the value-of first_name...

    Is the context node correct?

    I mean, maybe first_name isn't filling in because it doesn't exist in directly inside the context node.

    Can you show some XML source, and your XSLT document?

  • #5
    New Coder
    Join Date
    Jun 2002
    Location
    NYC
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    I got it working.

    The code I posted was probably correct, but since I used yours and it works, we won't fix what's not broke.

    The entire table of textboxes was called from <xsl:apply-templates select="Customers"/>

    which was the problem. It needed to be select="//Customers"/>

    Thanks for your effort. I've a lot to learn yet and you'll most likely be seeing me here again.

  • #6
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    , glad it worked out. Those XPath selectors can get tricky sometimes.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •