Re: template matching.. display the data

Subject: Re: template matching.. display the data
From: Duane Nickull <webmaster@xxxxxxxxxxxxxxxxx>
Date: Tue, 23 Mar 1999 15:14:14 -0800
Hi Nilofer:

Actually, this is a feature which makes XML very powerful.  Let's take
for example, that you have 3 different types of users that need access
to the same data, but have drastically different viewing hardware.  

For instance, Viewer #1 has a PC with a 19" monitor on it.  Viewer#2 has
only a digital cell phone and Viewer #3 only has a car mounted ETU
(Enhanced Telephone Unit - like a taxicab).  All your data is stored in
one central db and run through an XSL engine which in turn, outputs
specific data format types based on user request.
This model allows the actual data to be manipulated in ways that are
specific to the end user.  In order to do this though, you have to keep
separate content as the cell phone user would probably want text only
and cannot handle attributes like color="blue" or font="arial".  The
ETU  user too would not be able to display actual images however, the PC
user would have the greatest amount of flexibility.


It will probably be a while before this is commonplace but there are
some vendors like datachannel already able to offer this type of an
xml/xsl engine.  

Your project sounds interesting and it will be cool to see what it is.

Duane Nickull

Nilofer Motiwala wrote:
> 
> Hello Duane,
>         Thanks much for providing the exmaples, the matching works.
> However, i have a question on one of the comments you made regarding
> XML.
> You say that the purpose of XML is to separate the data from the style.
> I totally agree with that, but what happens in a situation, when
> there is a user dictated style asscociated with each set of data.
> 
> For eg,
> 
> The user has the flexibility to select the font and color and other style
> attributes for certain data. Next time, when the user wants to view the
> same information, i would like to display it in the same style as
> the user had selected initailly. In this case wouldn't the style be an
> attribute of the data?
> 
> Does that defeat the purpose of XML?
> 
> The reason i ask is that I am working on a proof of concept project,
> and I need to find out if XML is a viable candidate.
> 
> Thanks again
> Nilofer
> 
> On Mon, 22 Mar 1999, Duane Nickull wrote:
> 
> > Hello Nilofer:
> >
> > It's Duane Nickull (xmldirectory.com) again.  I have made your files for
> > you and uploaded them onto my server.  They are available for viewing
> > at:
> >
> > http://www.xmldirectory.com/tests/
> >
> > There are two files.  The first one, name.xml, is as follows:
> >
> > <?xml version="1.0" encoding="iso-8859-1" ?>
> > <?xml:stylesheet type="text/xsl" href="name.xsl"?>
> >
> > <Name>
> > <!--here is the first person-->
> >     <person>
> >       <first>
> >           Nilofer
> >     </first>
> >       <last>
> >           lastnamehere
> >       </last>
> >       </person>
> >
> > <!--here is another person-->
> >       <person>
> >       <first>
> >           Duane
> >       </first>
> >       <last>
> >           Nickull
> >       </last>
> >     </person>
> >
> > </Name>
> >
> > As you can see, I have removed the attributes you had of type="text" and
> > color="blue" fromt eh xml document.  That's what xml is all about,
> > separating content from design markup.  The text and color stuff belongs
> > in the *.xsl document.
> >
> > Now here is the *.xsl document.  I have streamlined it a bit:
> >
> > <?xml version="1.0"?>
> > <HTML xmlns:xsl="http://www.w3.org/TR/WD-xsl";>
> >
> > <head></head>
> > <body>
> >
> >
> >       <xsl:for-each select="Name/person">
> >             <DIV STYLE="background-color:teal; color:white; padding:4px;
> >       width:50%;">
> >               <SPAN STYLE="font-weight:italic; color:white">
> >                       This person's first name is: <xsl:value-of select="first"/><br/>
> >                       This person's last name is: <xsl:value-of select="last"/><hr/>
> >               </SPAN>
> >              </DIV>
> > </xsl:for-each>
> >
> > </body>
> > </HTML>
> >
> > If you go to my server and view this in IE 5.0 you will see the names
> > and values expressed in this *.xsl sheet.
> >
> > Play around with this a bit and see what happens.
> >
> > Duane Nickull
> > www.cartnetwork.com
> > "E-commerce since way before it was cool"
> >
> >
> >
> >
> >
> >
> > Nilofer Motiwala wrote:
> > >
> > > Duane,
> > >         Thanks for the response. However the <value-of select> tag is
> > > not living up to expectations!
> > >
> > > here is my xsl file
> > >
> > > <xsl:template match="/">
> > >    <xsl:for-each select="Name">
> > >       <xsl:value-of select="Name"/>
> > >    </xsl:for-each>
> > > </xsl:template>
> > >
> > > This however produces a blank page.
> > >
> > > If i put in a "Hello world" in side of the for-each, it get's printed out!
> > >
> > > So where am i going wrong here?
> > >
> > > Would be great if someone could point out my mistake.
> > >
> > > Thanks much
> > > Nilu
> > >
> > > ---------- Forwarded message ----------
> > > Date: Mon, 22 Mar 1999 13:36:56 -0800 (PST)
> > > From: Nilu <nmotiwal@xxxxxxxxxxxxxx>
> > > Reply-To: nmotiwal@xxxxxxxx
> > > To: nilum
> > > Subject: Re: template matching.. display the data (fwd)
> > >
> > > --------------------------------------------------------------------------
> > > When the going gets tough,
> > > The tough gets going!
> > >
> > >                         Nilofer Motiwala
> > >                         *****************
> > > ---------------------------------------------------------------------------
> > >
> > > ---------- Forwarded message ----------
> > > Date: Fri, 19 Mar 1999 19:30:38 -0800
> > > From: Duane Nickull <webmaster@xxxxxxxxxxxxxxxxx>
> > > Reply-To: xsl-list@xxxxxxxxxxxxxxxx
> > > To: xsl-list@xxxxxxxxxxxxxxxx
> > > Subject: Re: template matching.. display the data
> > >
> > > Hello Nilofer:
> > >
> > > Try this
> > >
> > > <xsl:for-each select="Name">
> > >    Hello, the name is:  <xsl:value-of select="Name"/>
> > > </xsl:for-each>
> > >
> > > This will print the value of the name for each.
> > >
> > > If you want to have it diplayed in blue text,  you can use xsl to do
> > > this also.
> > >
> > > <xsl:for-each select="Names">
> > >       <DIV STYLE="background-color:gray; color:blue; padding:4px;
> > > width:50%%;">
> > >         <SPAN STYLE="font-weight:bold; color:blue"><xsl:value-of
> > > select="Names"/></SPAN>
> > >        </DIV>
> > > </xsl:for-each>
> > >
> > > Any tag that occurs only once like the <xsl:value-of select="Names"/>
> > > it is really important to remember to use the / character after the
> > > select value.
> > >
> > > I hope this helps.
> > >
> > > Duane Nickull
> > > webmaster@xxxxxxxxxxxxxxxx
> > > "Indexing XML for the Internet"
> > >
> > > Nilofer Motiwala wrote:
> > > >
> > > > Hello all,
> > > >     I have a question on the template matching.
> > > >
> > > > My Xml file has some data of the form
> > > >
> > > > <Name type="text" color="blue">
> > > >      Nilofer
> > > > </Name>
> > > >
> > > > I am interested in matching the type field of the Name tag, and if it is
> > > > a text then displaying the data.
> > > >
> > > > Here is what I tried:
> > > >
> > > > <xsl:template match="Name[@Type='text']">
> > > >
> > > > </xsl:template>
> > > >
> > > > 1) Not too sure how to display the data
> > > > 2) Tried using the xsl:text and xsl:process-children, within the
> > > >    tempalte match and IE5 was not happy
> > > >
> > > > does any one know how to go about this task?
> > > >
> > > > Thanks for answering my queries!
> > > >
> > > > Nilofer Motiwala
> > > >
> > > >  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
> >
> >
> >  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