Re: MSIE5b2 compliance with latest XSL-WD?

Subject: Re: MSIE5b2 compliance with latest XSL-WD?
From: "Biron,Paul V" <Paul.V.Biron@xxxxxx>
Date: Mon, 28 Dec 1998 11:05:55 -0800
> Date: Wed, 23 Dec 1998 09:20:45 -0500
> From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
> Subject: Re: MSIE5b2 compliance with latest XSL-WD?
> 
> Here, Paul, is some feedback plus a working stylesheet for your example.
> 
Thanx Ken,

You're a lifesaver!  A few comments below...

> At 98/12/22 16:38 -0800, Biron,Paul V wrote:
> >I've had no end to problems, among the biggest is simply getting ANYTHING
> to
> >output,
> >even for simple stylesheets.
> 
> >	1) without the <xsl:template match="employees"> rule
> >	    (i.e. a match on the root level element) in there,
> >	    IE5b2 displays only those things generated in the
> >		<xsl:template match="/"> rule.
> >		
> >		WHY?  XT handles it in the way which I believe to be
> >		"correct"...that is, there should be no need for this
> >		extra rule.
> I've learned an explicit catch-all rule is needed:
> 
> <xsl:template><xsl:apply-templates/></xsl:template>
> 
> ..... *AND* (important) this rule goes at the *start* of the program, not
> just anywhere, as Microsoft implies behaviour of templates based on
> template location in the file (unlike W3C-WD2).
> 		
Great!  This does the trick.

At first glance, it appears to me that it is necessary to put the MOST
SPECIFIC templates last in the stylesheet to get IE5b2 to correct
distinquish them.  Is that your experience?  Has anyone been able to figure
out a more "detailed" explanation of HOW location within the file effects
template behavior for IE5b2?

That is, suppose I have two templates for matching "sections".

<xsl:template match="section">
	<xsl:comment>
		This should match "top level" sections
	</xsl:comment>
<xsl:template match="section/section">
	<xsl:comment>
		This should match "nested" sections.
	</xsl:comment>
</xsl:template>

If the order of these is reverse, IE5b2 doesn't match the nested sections
correctly.

> >	2) Is it really true that <xsl:apply-template/> doesn't
> >	    work for output #PCDATA as I've commented below?  It
> >	    certainly appears to be the case to me.  Again, XT
> >	    handles the <xsl:apply-templates/> method just fine.
> 
> For MS-XSL, yes it really is true ... I've learned an explicit catch-all
> rule is needed:
> 
> <xsl:template match="textnode()"><xsl:value-of/></xsl:template>
> 
> .... and I've put both of these at the start of my stylesheets as
> "default"
> behaviours I would expect to have already been there.
> 	
According to WD2, Section 2.5.2 "Built-in Templates", the XSL processor is
supposed to imply the above 2 rules (well, almost).  The actual built-in
rules in WD2 are

<xsl:template match="*|/">
	<xsl:apply-templates/>
</xsl:template>

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

But as we learn below, IE5b2 doesn't allow "|" in patterns, so the default
rule that Ken gives in 1) is necessary.  Shame that MS can't even spell
(requiring match="textnode()" instead of the actual match="text()" as
suggest by James Clark in his reply to my original post), they've licensed
all that great spellchecking software for Office and other products.

> >     OK, I'll accept that IE5b2 doesn't do "or" in patterns.
> >     I think this is documented on SBN.  I'll rewrite this as 4
> >     separate templates
> >	<xsl:template match="name | birthdate | ss_number | position">
> 
> Since all four elements are children of the <employee> element, I chose to
> use a short-form that means it is unnecessary to have four separate
> templates.  The short form is "employee/*" which reads "all child elements
> of the <employee> element" ... though it might mean "all child nodes of
> the
> <employee> element node" (would this include attributes, comments, pis,
> etc?).
> 
For this particular stylesheet that works because the elements in the OR
pattern constitute ALL of the possible child elements of employee.  In
general, however, let's hope MS implements OR patterns in their next
release:-)

Just did a quick scan thru WD2 and "employee/*" should be limited to ELEMENT
children according to 2.6.1.

	* can be used instead of an element type name as a wildcard

All attribute children would be matched by "@*", comment children by
"comment()" and PI children with "pi()".

> Good luck with the above, Paul ... I hope it gets you off the ground.
> 
Thanx again, Ken.  It sure does.  I've applied these small changes to
several other "real" stylesheet's I'd created and they now function
"correctly" in IE5b2 (that is, give me the results I want, not those
prescribed by WD2).

Paul V. Biron
SGML Business Analyst
Kaiser Permanente, So Cal


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


Current Thread