RE: Newbie Needs Help

Subject: RE: Newbie Needs Help
From: Jonathan Marsh <jmarsh@xxxxxxxxxxxxx>
Date: Thu, 17 Dec 1998 16:50:05 -0800
I believe that <xsl:apply-templates/> is implemented correctly.  By default
it selects all children, elements, text, even pis and comments.  A feature
that is not implemented in the beta 2 release is the built-in templates.
You must add these templates to the start of the stylesheet if you wish to
have this behavior.  The templates shown here are slightly different than
those described in the previous XSL WD, but accomplish similar
functionality.

Also note that the namespace URL in Guy's example previously was missing a
":", which is corrected below.  Otherwise this example only builds on his by
providing a more generic solution to built-in templates.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";>
     <!-- default templates -->
     <xsl:template><xsl:apply-templates/></xsl:template>
     <xsl:template match="textnode()"><xsl:value-of/></xsl:template>

     <xsl:template match="/">
          <html>
               <head>
                    <title>Test</title>
               </head>
               <body>
                    <xsl:apply-templates />
               </body>
          </html>
     </xsl:template>

     <xsl:template match= "greeting">
          <div style="color:red; font-size: 16pt">
               <xsl:apply-templates />
          </div>
     </xsl:template>
</xsl:stylesheet>

> -----Original Message-----
> From: Chris Maden [mailto:crism@xxxxxxxxxxx]
> Sent: Thursday, December 17, 1998 3:38 PM
> To: xsl-list@xxxxxxxxxxxxxxxx
> Subject: Re: Newbie Needs Help
> 
> 
> <xsl:apply-templates/> is not implemented correctly in MSIE 5b2.  It
> only applies templates to *element* children of the current node; it
> does not apply the default template to *character* children.  As a
> result, mixed content can not be processed.
> 
> In the original questioner's case, he should use <xsl:value-of
> select="."/>, which will return the character data of the current
> element.
> 
> Note that by this method you can get *either* the text *or* the
> element children, not both, making it impossible to do real documents
> with the current implementation.  I sincerely hope that MS will fix
> this severe bug in the next beta.
> 


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


Current Thread