How to extract data from a checkbox & print it in MS Word

Discussion in 'XML' started by zahid, Jun 13, 2011.

  1. zahid

    zahid Guest

    Dear All,

    Could you please guide me on how can using XML read checkbox data from
    a website and then place info about that checkbox into MSWord:

    For eg.

    A) America
    B) Britain
    C) Canada

    suppose B) Britain is checked, then how can I pick up Britain from a
    website using XML and then print it on MSWord.

    Thank you all in advance,
    Zahid
    zahid, Jun 13, 2011
    #1
    1. Advertising

  2. zahid

    Peter Flynn Guest

    On 13/06/11 11:16, zahid wrote:
    > Dear All,
    >
    > Could you please guide me on how can using XML read checkbox data from
    > a websiteand then place info about that checkbox into MSWord:


    XML is not a programming language, so it cannot do this by itself, but
    there are XML-based systems which can help.

    One way is to use XForms, and possibly XQuery and XSLT, to specify and
    handle the data, by creating the web page using XForms in XHTML. See
    http://www.w3.org/MarkUp/Forms/2003/xforms-for-html-authors.html for
    more details. There are also proprietary solutions to this from
    Microsoft, Oracle, and others.

    > For eg.
    >
    > A) America
    > B) Britain
    > C) Canada
    >
    > suppose B) Britain is checked, then how can I pick up Britain from a
    > website using XML and then print it on MSWord.


    You don't say if you have access to the server to create the web page
    and suitable scripts.

    If you want to (or you are constrained to) use existing (non-XML) server
    technology, you need to write a server script to accept the submitted
    data, and you need to modify the web page to put the URI of your script
    into the action attribute of the form element. The script has to extract
    the form data from the CGI environment and *then* you can use XSLT to
    insert the values into a Word OOXML (.docx) document.

    ///Peter
    --
    XML FAQ: http://xml.silmaril.ie/
    Peter Flynn, Jun 13, 2011
    #2
    1. Advertising

  3. zahid

    zahid Guest

    Hi Peter,

    Thanks for your reply.

    I have a software which is XML based. It picks up data from textboxes
    on our website and then places that data automatically into MS word
    document. It uses the following stylesheet to do so.

    <w:body>
    <wx:sect>
    <w:p>
    <w:r>
    <w:rPr>
    <w:sz w:val="28" />
    <w:sz-cs w:val="28" />
    </w:rPr>
    <w:t><xsl:value-of select="Fruit"/></w:t>
    </w:r>
    </w:p>
    <w:p/>
    <w:p>
    </wx:sect>
    </w:body>


    The above code picks up the data stored in the "Fruit" text box and
    places it into MSWord.

    I now just want to take this a step further so that it can also pick
    up data from a checkbox and place the checked option in MS Word. So if
    on the website B) Britain is checked then
    Britain should be placed in the MSWord. All I need is the syntax in
    the stylesheet which would make this happen.

    Thanks for you help,
    Zahid







    On Jun 13, 11:37 pm, Peter Flynn <> wrote:
    > On 13/06/11 11:16, zahid wrote:
    >
    > > Dear All,

    >
    > > Could you please guide me on how can using XML read checkbox data from
    > > a websiteand then place info about that checkbox into MSWord:

    >
    > XML is not a programming language, so it cannot do this by itself, but
    > there are XML-based systems which can help.
    >
    > One way is to use XForms, and possibly XQuery and XSLT, to specify and
    > handle the data, by creating the web page using XForms in XHTML. Seehttp://www.w3.org/MarkUp/Forms/2003/xforms-for-html-authors.htmlfor
    > more details. There are also proprietary solutions to this from
    > Microsoft, Oracle, and others.
    >
    > > For eg.

    >
    > > A) America
    > > B) Britain
    > > C) Canada

    >
    > > suppose B) Britain is checked, then how can I pick up Britain from a
    > > website using XML and then print it on MSWord.

    >
    > You don't say if you have access to the server to create the web page
    > and suitable scripts.
    >
    > If you want to (or you are constrained to) use existing (non-XML) server
    > technology, you need to write a server script to accept the submitted
    > data, and you need to modify the web page to put the URI of your script
    > into the action attribute of the form element. The script has to extract
    > the form data from the CGI environment and *then* you can use XSLT to
    > insert the values into a Word OOXML (.docx) document.
    >
    > ///Peter
    > --
    > XML FAQ:http://xml.silmaril.ie/
    zahid, Jun 15, 2011
    #3
  4. zahid

    Peter Flynn Guest

    On 15/06/11 14:01, zahid wrote:
    > Hi Peter,
    >
    > Thanks for your reply.
    >
    > I have a software which is XML based. It picks up data from textboxes
    > on our website and then places that data automatically into MS word
    > document. It uses the following stylesheet to do so.


    I think there is some confusion here. The following is not a
    stylesheet; it's a result tree fragment (of an OOXML
    document) with a single embedded XSLT element. It's also not
    well-formed, so it won't work as it stands

    > <w:body>
    > <wx:sect>
    > <w:p>
    > <w:r>
    > <w:rPr>
    > <w:sz w:val="28" />
    > <w:sz-cs w:val="28" />
    > </w:rPr>
    > <w:t><xsl:value-ofselect="Fruit"/></w:t>
    > </w:r>
    > </w:p>
    > <w:p/>
    > <w:p>
    > </wx:sect>
    > </w:body>


    The <w:p/> is unnecessary and the following <w:p> is not closed.

    > The above code picks up the data stored in the "Fruit" text box and
    > places it into MSWord.


    Fruit must therefore be a child element of the context element node
    where this fragment is traversed.

    > I now just want to take this a step further so that it can also pick
    > up data from a checkbox and place the checked option in MS Word. So
    > if on the website B) Britain is checked then Britain should be placed
    > in the MSWord. All I need is the syntax in the stylesheet which would
    > make this happen.


    Use the same as above but substitute the name of the element which
    contains the checkbox variable value; and do this in the relevant template.

    You have not shown a minimal example here, and you have not shown what
    the data structure is within which this fragment gets used. So it is not
    possible to answer your question.

    ///Peter
    --
    XML FAQ: http://xml.silmaril.ie/
    Peter Flynn, Jun 16, 2011
    #4
  5. zahid

    essi Guest

    zahid wrote:
    > Could you please guide me on how can using XML read checkbox data from
    > a website and then place info about that checkbox into MSWord:


    This particular newsgroup really is dedicated to XML related
    conversations.

    Now you are (probably??) asking how to extract data from some Web site,
    and that means extrarcting something from HTML. The difference between
    those two may not seem to be so significant, yet it is.

    This far you have passed one XSL stylesheet, that actually is purely XML
    related stuff. But secondly you posted some HTML code from your own Web
    site. That HTML works so far that it shows a Web page on browser, but
    that's it.

    Now you are asking something, how to add or make some checkbox
    somewhere. And after then convert something to Word format.

    There are parts in your question that somehow may belong to XML family
    tree. Yet there are some parts that maybe could be solved with PHP or
    some other programming language or with something else.

    I do not understand what you are actually asking. If someone else does,
    then hopefully he/she can help you.

    Essi
    essi, Jun 28, 2011
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. crazyprakash
    Replies:
    4
    Views:
    3,365
    adrian
    Oct 30, 2005
  2. keto
    Replies:
    0
    Views:
    908
  3. David Cournapeau

    print a vs print '%s' % a vs print '%f' a

    David Cournapeau, Dec 30, 2008, in forum: Python
    Replies:
    0
    Views:
    337
    David Cournapeau
    Dec 30, 2008
  4. zahid
    Replies:
    2
    Views:
    1,040
    Joe Kesselman
    Jun 29, 2011
  5. Guest
    Replies:
    4
    Views:
    287
    Guest
    May 12, 2006
Loading...

Share This Page