[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: ?Dataislands?

Subject: Re: ?Dataislands?
From: "Robert Koberg" <rob@xxxxxxxxxx>
Date: Fri, 1 Mar 2002 04:02:10 -0800
.selectsinglenode dataisland javascript
Hi, just picked up on this thread...

I like to "re-represent" the XML structure in the HTML with class
attributes, e.g.

<article>
   <title>The tite</title>
   <para>The para</para>
   <section>
      <title>The tite</title>
      <para>The para</para>
   </section>
</article>

Can look like:

<SPAN CLASS="article">
   <DIV CLASS="title">The Title</DIV>
   <DIV CLASS="para">The para</DIV>
   <SPAN CLASS="section">
     <DIV CLASS="title">The Title</DIV>
     <DIV CLASS="para">The para</DIV>
  </SPAN>
</SPAN>

This has two benefits:
1. You know the structure of the XML
2. You can use CSS to style a page very easily/nicely



----- Original Message -----
From: "Chris Bayes" <chris@xxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, March 01, 2002 1:27 AM
Subject: RE:  ?Dataislands?


> Rosa,
> The best way to do this is to generate html from your xml which has an
> attribute that contains an xpath to the associated xml element or calls
> a function with the path as a parameter. Say your xml looked something
> like this
>
> <questions>
> <tab no="1">
> <question text="what is your favourite
> colour"></question>
> <question text="what is your favourite day"></question>
> </tab>
> <tab no="2">
> <question text="what is your favourite
> colour"></question>
> <question text="what is your favourite day"></question>
> </tab>
> </questions>
>
> You could have xslt that displays tabs similar to the paging examples at
> http://www.bayes.co.uk/xml/index.xml?/xml/tutorial/paging/paging.xml
> Then for questions the xslt would be something like
>
> <xsl:template match="question">
> <xsl:value-of select="@text" />
> <input type="text" value="{.}">
> <xsl:attribute name="onblur">Javascript:updateXML(this,
> '<xsl:call-template name="path" />');</xsl:attribute>
> </input>
> </xsl:template>
>
> <xsl:temlpate name="path">
> <xsl:for-each select="(ancestor-or-self::*)">
> /*[<xsl:value-of
> select="1+count(preceding-sibling::*)"/>]
> </xsl:for-each>
> </xsl:template>
>
> Which would produce this html for the second tab
>
> what is your favourite colour <input type="text" value=""
> onblur="Javascript:updateXML(this, '/*[1]/*[2]/*[1]')'" />
> what is your favourite day <input type="text" value=""
> onblur="Javascript:updateXML(this, '/*[1]/*[2]/*[2]')'" />
>
> Then your update function would simply be something like
>
> function updateXML(obj, path){
> var node = XMLISLAND.selectSingleNode(path);
> node.nodeValue = obj.value;
> }
>
> I wouldn't use data islands though it is much easier to just create an
> xml and xsl object
>
> var XMLOBJECT = new ActiveXObject("MSXML2.DOMDocument");
> var XSLOBJECT = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
>
> Ciao Chris
>
> XML/XSL Portal
> http://www.bayes.co.uk/xml
>
>
> > -----Original Message-----
> > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Rosa Cheng
> > Sent: 28 February 2002 22:25
> > To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> > Subject:  ?Dataislands?
> >
> >
> > Can anyone please tell me what is the best way to approach
> > such a problem using XSL and XML?
> >
> > I have a page of questions that are divided into tab
> > sections, with a bar of tabs at the top of the page.  You can
> > tab through them or click next to go onto the next tab
> > section.  You can also come back to the tab sections before
> > by clicking on the tabs at the top of the page.  What I want
> > to do though is to ONLY submit all the answers at the very
> > end of the series of questions, i.e. there is a submit button
> > only on the very last tab page.  But as I change the answers
> > and tab through, I want to also keep the answers I had
> > entered before.  This means I have to somehow save the
> > answers entered on the client side through the course of
> > questions answering.
> >
> > There is one possible solution that has come up and it is:
> > The original XML will come in and a tabbed questions page
> > will be displayed based on that original XML.  This XML will
> > also be binded to a dataisland.  In fact from there onwards,
> > the pages will be displayed using the XML from the
> > dataisland.  So all I need to do is to just keep updating the
> > XML binded to the dataisland.  And after the user is
> > satisfied with what it has answered, then the XML binded to
> > the dataisland will be submitted to the server.  (But then
> > again, it also means I need to write some script that will
> > update the dataisland XML with the new answers on the page
> > with each tab click.)
> >
> > I'm not sure whether this is the best approach, can anyone
> > please tell me whether there is a better way or this approach
> > is fine?  If this approach is fine, can anyone direct me to
> > an example of such a page or where to find the javascript to
> > update the binded XML with answers grabbed from the HTML page
> > displayed?
> >
> > Thank you in advance.
> >
> > Rosa
> >
> > P.S. if there is anything that is still unclear please tell
> > me, I will try to explain it better.
> >
> >  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> >
> >
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • RE: ?Dataislands?
    • Joshua Allen - Fri, 1 Mar 2002 00:33:28 -0500 (EST)
      • <Possible follow-ups>
      • Chris Bayes - Fri, 1 Mar 2002 04:24:32 -0500 (EST)
        • Robert Koberg - Fri, 1 Mar 2002 07:01:03 -0500 (EST) <=
      • jparlato - Fri, 1 Mar 2002 07:57:49 -0500 (EST)

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.