RE: The XSL-List Digest V1 #250

Subject: RE: The XSL-List Digest V1 #250
From: "Biron,Paul V" <Paul.V.Biron@xxxxxx>
Date: Tue, 22 Dec 1998 16:38:31 -0800
> Date: Mon, 21 Dec 1998 17:06:26 -0500
> From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
> Subject: Re: MSIE5b2 compliance with latest XSL-WD?
> 
> To: XSL List <xsl-list@xxxxxxxxxxxxxxxx>
> 
> At 98/12/21 11:27 -0500, Paul_Tihansky@xxxxxxxxxxxx wrote:
> >     I realized that Microsoft had implemented a few features in MSIE5b2
> >that supposedly jumped the gun on the 19981216 XSL Working Draft.  Now
> that
> >the new Working Draft  is out, could someone summarize whether MSIE5b2 is
> >in compliance.  
> 
> Not!  ... though, of course, compliance isn't defined yet ... I will say
> with certainty they aren't in alignment with the new Working Draft.
> 
<snip/>

> I honestly feel I have been spending an awful lot of unnecessary time
> trying to grok the XSL in IE5b2, and I'm curious if others have
> experienced
> the same problem, or is it just me?  If it is just me, then I "have some
> 'splainin to do" to my customer (as Ricky would say), but from some
> private
> comments I've received, I've been pacified it is through no fault of my
> own. :{)}
> 
I've had no end to problems, among the biggest is simply getting ANYTHING to
output,
even for simple stylesheets.

Included below is the first stylesheet (of any complexity whatsoever) that
I've been able to get to produce results.  It is intended for use with one
of the sample data files used in the SBN examples.  The stylesheet has
several comments/questions embedded within it.  If anyone can give me
answers to any of them I would be greatly appreciative.

<!-- employees.xml -->
<?xml:stylesheet type="text/xsl" href="employees.xsl" ?>
<employees>
    <employee>
      <name>James Smith</name>
      <birthdate>1970-09-30</birthdate>
      <ss_number>555-09-8410</ss_number>
      <position>file clerk</position>
    </employee>
    <employee>
      <name>Jane Jones</name>
      <birthdate>1968-03-22</birthdate>
      <ss_number>388-71-6662</ss_number>
      <position>marketing manager</position>
    </employee>
      <employee>
      <name>Mary Davis</name>
      <birthdate>1972-11-09</birthdate>
      <ss_number>884-99-3192</ss_number>
      <position>lead engineer</position>
     </employee>
</employees>

<!-- employees.xsl -->
<?xml version="1.0"?>
<!--
     This simply style sheet demonstrates difficulties I've
	 been having getting almost ANYTHING to work with the
	 IE5b2 implementation of the 2nd WD.
	 
	 Actually, this is the first stylesheet that I've been
	 able to create which produces ANY output with IE5b2.
	 Even with the <xsl:value-of...> hack mentioned below
	 I can't get any output out of more complex stylesheets
	 I've written that work just fine with XT (version 19981220).
	 
	 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.
		
	 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.
	   
	 3) IE5b2 seems to generate "more" HTML than is provided
	    for in this stylesheet.  By that I mean the following.
		When you "directly browse" the XML file file in IE5b2,
		the column widths of the table seem to be set to no
		wider than the column header text. It seems to start
		"rendering" the table in the <xsl:template match="/">
		rule; another way of thinking of this is that IE5b2 is
		adding width="xxx" attributes to the tr/td's based on
		how wide the <th> text is.
		
		However, if you load the output of XT's processing
		of this stylesheet, the IE5b2 lets the longest <td> of
		any row determine the width of the columns.
		
		WHY?
  -->
	 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";>
	<xsl:template match="/">
		<html>
			<head>
				<title>XSL Test</title>
			</head>
			<body bgcolor="#FFFFFF">
				<table border="1">
					<tr>
						<th>Name</th>
						<th>DOB</th>
						<th>SSN</th>
						<th>Position</th>
					</tr>
					<xsl:apply-templates/>
				</table>
			</body>
		</html>
	</xsl:template>
<!--
     If the following template is omitted, only the table header row is
generated
  -->
	<xsl:template match="employees">
		<xsl:apply-templates/>
	</xsl:template>
	<xsl:template match="employee">
		<tr>
			<xsl:apply-templates/>
		</tr>
	</xsl:template>
<!--
     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">
		<td>
			<xsl:apply-templates/>
		</td>
	</xsl:template>
  -->
	<xsl:template match="name">
		<td>
<!--
     in order to get any output of #PCDATA, you have to use
     <xsl:value-of .../> instead of <xsl:apply-templates/>.
     I wish I could give acknowledgment to whoever posted this little
      tidbit, but I've forgotten who it was
          <xsl:apply-templates/>
  -->
			<xsl:value-of select="."/>
		</td>
	</xsl:template>
	<xsl:template match="birthdate">
		<td>
<!--
			<xsl:apply-templates/>
  -->
  			<xsl:value-of select="."/>
		</td>
	</xsl:template>
	<xsl:template match="ss_number">
		<td>
<!--
			<xsl:apply-templates/>
  -->
  			<xsl:value-of select="."/>
		</td>
	</xsl:template>
	<xsl:template match="position">
		<td>
<!--
			<xsl:apply-templates/>
  -->
			<xsl:value-of select="."/>
		</td>
	</xsl:template>
</xsl:stylesheet>

HELP!!!!

> >Thanks to James Clark for being so responsive to developers' needs by
> >providing a tool for testing the new Working Draft.
> 
> Amen!
> 
> .......... Ken
> 
I'll third that great big thanx to James.

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


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


Current Thread