Web Analytics Made Easy -
StatCounter Filling a textbox with an xsl stylesheet - CodingForum

Announcement

Collapse
No announcement yet.

Filling a textbox with an xsl stylesheet

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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
    <input type="text" name="firstname" value="{firstname}"/>

    You should be able to use the attribute shortcut there.
    jasonkarldavis.com

    Comment


    • #3
      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.

      Comment


      • #4
        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?
        jasonkarldavis.com

        Comment


        • #5
          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.

          Comment


          • #6
            , glad it worked out. Those XPath selectors can get tricky sometimes.
            jasonkarldavis.com

            Comment

            Working...
            X