RE: Summary of results. Re: XSL Limitation? Is this possible?

Subject: RE: Summary of results. Re: XSL Limitation? Is this possible?
From: Pete Beazley <pete@xxxxxxxxxxxxxxxxx>
Date: Fri, 14 May 1999 16:51:55 -0400
Just a side comment -

By changing the "SUBJECT|VERB" template from "apply-templates" to 
"value-of", you could protect the SUBJECT and VERB content from processing 
by the "text()" template. So, if you wanted all text except SUBJECTs and 
VERBs to be italic for instance, you could make the following minor 
changes:

+ add the italic tags, <i>, to the "text()" template as shown here:

   <xsl:template match="text()">
   <i> <xsl:value-of /></i>
   </xsl:template>

+ change to "value-of" in the "SUBJECT|VERB" template as shown here:

   <xsl:template match="SUBJECT|VERB">
     <B><xsl:value-of /></B>
   </xsl:template>

--------
Pete Beazley - mailto:pete@xxxxxxxxxxxxxxxxx
ClearlyOnline, Inc. - XML & Web services - http://www.clearlyonline.com
1-724-942-1912    1-724-941-3698 fax
PGP public key - mailto:pgp.pete@xxxxxxxxxxxxxxxxx

On Friday, May 14, 1999 4:01 PM, Nicolas Pottier [SMTP:nic@xxxxxxxxxx] 
wrote:
>
> Thanks to everyone who mailed me solutions to my problem.  My confusion
> was mainly caused by IE5 not defining some standard templates by
> default, and once someone pointed these out things made more sense.
>
> Here is the solution I settled for in the end, along with what I've come
> to understand as how IE5 parses these templates.
>
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";>
>
>   <xsl:template match="/">
>     <HTML><BODY>
>       <xsl:apply-templates select="PARAGRAPH/SENTENCE"/>
>     </BODY></HTML>
>   </xsl:template>
>
>   <!-- Start of default XSL templates which IE should include but doesnt
> -->
>
>   <xsl:template match="text()">
>     <xsl:value-of/>
>   </xsl:template>
>
>   <xsl:template match="*">
>     <xsl:apply-templates/>
>   </xsl:template>
>
>   <!-- End of default XSL templates which IE should include but doesnt
> -->
>
>   <xsl:template match="SUBJECT|VERB">
>     <B><xsl:apply-templates/></B>
>   </xsl:template>
>
> </xsl:stylesheet>
>
> Now with some experimentation I've come to the following sequence of how
> IE is doing the conversion.
>
> 1) It gets to a node, and if that node has text, then tries to find a
> template which matches it.  It does this in reverse order of the
> declaration of the templates, ie the last template which matches is the
> one that is applied.
>
> 2) It now grabs the first child node, and tries to find a template which
> matches it.  Again, it does this in reverse order of the declaration of
> the templates (the last declared matching template is used).
>
> 	3) If that child has an <xsl:apply-templates/>, then it goes to (1) for
> 	that child, finding text templates and child node appropriatly.
>
> 4) After each child node, it again sees if there is any text, if so,
> then again it finds the last matching template and applies it.
>
> Does this sound reasonable to people, or have I created a model which
> matches my observations but is completely off.   The strange thing is
> that text() template matching seems to be a completely seperate process
> as the normal child node matching.  Also, are the default XSL templates
> which I declared in the above example correct?  (at least according to
> the current understanding of the XSL spec?)
>
> Thanks to everyone who mailed me a solution, I'm getting there with this
> XSL thing, slowly but surely.
>
> -Nic
>
> > On Friday, May 14, 1999 12:02 PM, Nicolas Pottier [SMTP:nic@xxxxxxxxxx] 
wrote:
> > >
> > > Hello everybody..
> > >
> > > I'm currently learning XSL, mostly using IE5 as my current platform, 
and
> > > have run into the following problem, which I have yet to figure out.
> > >
> > > Let's take this data.
> > >
> > > <PARAGRAPH>
> > > <SENTENCE>Grumpy <SUBJECT>Jack</SUBJECT> <VERB>went</VERB> up the
> > > hill.</SENTENCE>
> > > </PARAGRAPH>
> > >
> > > Is it possible to use XSL to convert that data into the following?
> > >
> > > <HTML>
> > > <BODY>
> > > Grumpy <B>Jack</B> <B>went</B> up the hill.
> > > </BODY>
> > > </HTML>
> > >
> > > As far as I've figured out, it doesn't seem possible, the main 
problem
> > > being that text is being mixed with other elements, and I'm unable to
> > > separate them out when parsing it.
> > >
> > > We've been racking our brain on this one for a little while and can't
> > > seem to figure it out.
> > >
> > > Anybody have any ideas?  This is something that is so simple in CSS, 
but
> > > seems impossible in XSL.
> > >
> > > Thanks,
> > >
> > > -Nic
> > >
> > > PS. I apologize if this has been covered before, I tried looking 
through
> > > the archives but couldn't find anything relevant. (though I did find
> > > some useful examples out there)
> > >
> > >
> > >  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