XSL and Textboxes


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: XSL and Textboxes

  1. #1
    Greg Rothlander Guest

    XSL and Textboxes


    I'm building an ASP page that is using XSL to transform an XML stream.
    I've set up a very simple test that is just a user id and password. All
    I want to do is get the user's current user id and password and display them
    in two textboxes. Then I want to modify one or both and them and hit an
    update button. Then the new values will stay and the database will be updated.

    All I really need to know is how to control the displaying of data in the
    textboxes via XSL. I can not get XSL to generate the Textboxes and put in
    the values when the page is loaded.

    It seems that the XSL samples I've seen and all the pages I've created are
    just displaying data. What about input? Is XSL not able to handle this
    or am I just not reading the right books?

    Thanks for any information...

    Greg


  2. #2
    Russell Jones Guest

    Re: XSL and Textboxes

    Include one of these in your stylesheet to create a text input control.

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

    or, more simply, if the node containing the ID and password data is the
    context node:
    <input type="text" name="txtSomething" value="{@id}"/>

    If the ID is an element rather than an attribute, leave out the @ sign in
    the preceding example.

    Russell Jones
    Sr. Web Development Editor,
    DevX.com

    "Greg Rothlander" <grothlander@austin400.com> wrote in message
    news:3b4cc9b9$1@news.devx.com...
    >
    > I'm building an ASP page that is using XSL to transform an XML stream.
    > I've set up a very simple test that is just a user id and password. All
    > I want to do is get the user's current user id and password and display

    them
    > in two textboxes. Then I want to modify one or both and them and hit an
    > update button. Then the new values will stay and the database will be

    updated.
    >
    > All I really need to know is how to control the displaying of data in the
    > textboxes via XSL. I can not get XSL to generate the Textboxes and put in
    > the values when the page is loaded.
    >
    > It seems that the XSL samples I've seen and all the pages I've created are
    > just displaying data. What about input? Is XSL not able to handle this
    > or am I just not reading the right books?
    >
    > Thanks for any information...
    >
    > Greg
    >




  3. #3
    Greg Rothlander Guest

    Re: XSL and Textboxes


    That for your example... it did help but I can not get the following to work
    and I do not know what I'm doing wrong.

    <input type="text" name="txtSomething">
    <xsl:attribute name="value">
    Enter your Name in this box
    </xsl:attribute>
    </input>

    Any ideas why this wouldn't work?

    This does, but I can not do anything programmatically with it.
    <input type="text" name="txtSomething" value="Enter your Name in this box"
    />

    Also, when I use the value="{.}" I end up with a text box with the {.} in
    it.

    Any ideas what I'm doing wrong?

    Thanks for your help,
    Greg Rothlander

    "Russell Jones" <arj1@northstate.net> wrote:
    >Include one of these in your stylesheet to create a text input control.
    >
    ><input type="text" name="txtSomething"><xsl:attribute
    >name="value"><xsl:value-of
    >select="yourselectpathhere"></xsl:attribute></input>
    >
    >or, more simply, if the node containing the ID and password data is the
    >context node:
    ><input type="text" name="txtSomething" value="{@id}"/>
    >
    >If the ID is an element rather than an attribute, leave out the @ sign in
    >the preceding example.
    >
    >Russell Jones
    >Sr. Web Development Editor,
    >DevX.com
    >
    >"Greg Rothlander" <grothlander@austin400.com> wrote in message
    >news:3b4cc9b9$1@news.devx.com...
    >>
    >> I'm building an ASP page that is using XSL to transform an XML stream.
    >> I've set up a very simple test that is just a user id and password. All
    >> I want to do is get the user's current user id and password and display

    >them
    >> in two textboxes. Then I want to modify one or both and them and hit

    an
    >> update button. Then the new values will stay and the database will be

    >updated.
    >>
    >> All I really need to know is how to control the displaying of data in

    the
    >> textboxes via XSL. I can not get XSL to generate the Textboxes and put

    in
    >> the values when the page is loaded.
    >>
    >> It seems that the XSL samples I've seen and all the pages I've created

    are
    >> just displaying data. What about input? Is XSL not able to handle this
    >> or am I just not reading the right books?
    >>
    >> Thanks for any information...
    >>
    >> Greg
    >>

    >
    >



  4. #4
    Russell Jones Guest

    Re: XSL and Textboxes

    What namespace are you using?

    "Greg Rothlander" <grothlander@austin400.com> wrote in message
    news:3b4e0c24$1@news.devx.com...
    >
    > That for your example... it did help but I can not get the following to

    work
    > and I do not know what I'm doing wrong.
    >
    > <input type="text" name="txtSomething">
    > <xsl:attribute name="value">
    > Enter your Name in this box
    > </xsl:attribute>
    > </input>
    >
    > Any ideas why this wouldn't work?
    >
    > This does, but I can not do anything programmatically with it.
    > <input type="text" name="txtSomething" value="Enter your Name in this box"
    > />
    >
    > Also, when I use the value="{.}" I end up with a text box with the {.} in
    > it.
    >
    > Any ideas what I'm doing wrong?
    >
    > Thanks for your help,
    > Greg Rothlander
    >
    > "Russell Jones" <arj1@northstate.net> wrote:
    > >Include one of these in your stylesheet to create a text input control.
    > >
    > ><input type="text" name="txtSomething"><xsl:attribute
    > >name="value"><xsl:value-of
    > >select="yourselectpathhere"></xsl:attribute></input>
    > >
    > >or, more simply, if the node containing the ID and password data is the
    > >context node:
    > ><input type="text" name="txtSomething" value="{@id}"/>
    > >
    > >If the ID is an element rather than an attribute, leave out the @ sign in
    > >the preceding example.
    > >
    > >Russell Jones
    > >Sr. Web Development Editor,
    > >DevX.com
    > >
    > >"Greg Rothlander" <grothlander@austin400.com> wrote in message
    > >news:3b4cc9b9$1@news.devx.com...
    > >>
    > >> I'm building an ASP page that is using XSL to transform an XML stream.
    > >> I've set up a very simple test that is just a user id and password.

    All
    > >> I want to do is get the user's current user id and password and display

    > >them
    > >> in two textboxes. Then I want to modify one or both and them and hit

    > an
    > >> update button. Then the new values will stay and the database will be

    > >updated.
    > >>
    > >> All I really need to know is how to control the displaying of data in

    > the
    > >> textboxes via XSL. I can not get XSL to generate the Textboxes and put

    > in
    > >> the values when the page is loaded.
    > >>
    > >> It seems that the XSL samples I've seen and all the pages I've created

    > are
    > >> just displaying data. What about input? Is XSL not able to handle

    this
    > >> or am I just not reading the right books?
    > >>
    > >> Thanks for any information...
    > >>
    > >> Greg
    > >>

    > >
    > >

    >




  5. #5
    Greg Rothlander Guest

    Re: XSL and Textboxes


    Well that may be the problem. I'm note using one as far as I now!

    Here is a copy of the XSL file I was trying to convert using the method you
    gave me. It's just a simple test of a combo box and I added a textbox to
    it and tried to give it a value using the attribute method you suggested.
    I've used the attribute method in the past and I didn't have any problems
    with it. The following is the only way I could get it to work with a textbox.
    Is there something else I need?

    Thanks,
    Greg

    <?xml version="1.0" ?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
    <xsl:template match="/">

    <input type="text" name="txtSomething" value="Enter your name in this box"/>

    <xsl:for-each select="select">
    <select size="1" name="txtSelectName">
    <option />
    <xsl:for-each select="this/month">
    <option>
    <xsl:value-of select="."/>
    </option>
    </xsl:for-each>
    </select>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>

  6. #6
    CoolDude Guest

    Re: XSL and Textboxes


    Ya Mistr,
    Ya got serus probs, ta think ya ar not using namespace.
    Dis is a fundamental of XSLT.
    Ya better go do a curse.
    Dude
    "Greg Rothlander" <grothlander@austin400.com> wrote:
    >
    >Well that may be the problem. I'm note using one as far as I now!
    >
    >Here is a copy of the XSL file I was trying to convert using the method

    you
    >gave me. It's just a simple test of a combo box and I added a textbox to
    >it and tried to give it a value using the attribute method you suggested.
    > I've used the attribute method in the past and I didn't have any problems
    >with it. The following is the only way I could get it to work with a textbox.
    > Is there something else I need?
    >
    >Thanks,
    >Greg
    >
    ><?xml version="1.0" ?>
    ><xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
    ><xsl:template match="/">
    >
    > <input type="text" name="txtSomething" value="Enter your name in this box"/>
    >
    > <xsl:for-each select="select">
    > <select size="1" name="txtSelectName">
    > <option />
    > <xsl:for-each select="this/month">
    > <option>
    > <xsl:value-of select="."/>
    > </option>
    > </xsl:for-each>
    > </select>
    > </xsl:for-each>
    ></xsl:template>
    ></xsl:stylesheet>



  7. #7
    Scott Bockelman Guest

    Re: XSL and Textboxes


    I think what Professor Jones meant was what namespace is decalred for the
    version of XSL. I can see from your source that you are using an older namespace,
    originally supporting the draft recommendation of XSL, but not the current
    spec. In any case, the MSXML parser should support the syntax implemented
    in that draft when you specify that namespace.

    That explains why the {.} syntax is not supported.

    NOW,

    here's how you might create the Text Box:

    <xsl:element name="input">
    <xsl:attribute name="type">text</xsl:attribute>
    <xsl:attribute name="name">txtSelectName</xsl:attribute>
    <xsl:attribute name="size">25</xsl:attribute>
    <xsl:attribute name="value">Enter your name in this box</xsl:attribute>

    </xsl:element>


    Hope this helps,

    Scott



    "Greg Rothlander" <grothlander@austin400.com> wrote:
    >
    >Well that may be the problem. I'm note using one as far as I now!
    >
    >Here is a copy of the XSL file I was trying to convert using the method

    you
    >gave me. It's just a simple test of a combo box and I added a textbox to
    >it and tried to give it a value using the attribute method you suggested.
    > I've used the attribute method in the past and I didn't have any problems
    >with it. The following is the only way I could get it to work with a textbox.
    > Is there something else I need?
    >
    >Thanks,
    >Greg
    >
    ><?xml version="1.0" ?>
    ><xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
    ><xsl:template match="/">
    >
    > <input type="text" name="txtSomething" value="Enter your name in this box"/>
    >
    > <xsl:for-each select="select">
    > <select size="1" name="txtSelectName">
    > <option />
    > <xsl:for-each select="this/month">
    > <option>
    > <xsl:value-of select="."/>
    > </option>
    > </xsl:for-each>
    > </select>
    > </xsl:for-each>
    ></xsl:template>
    ></xsl:stylesheet>



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center