This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Can XSL recognize IE5 versus Netscape?


At 10 May 2000 15:01 -0400, Medina, Edward wrote:
 > Hey Tony, why did you do this?
 > 
 > <xsl:otherwise>
 >    <msxsl:choose>
 >      <msxsl:when test=".">
 >        </msxsl:when>
 >         <msxsl:otherwise>
 >           <p>Vendor: <xsl:value-of select="system-property('xsl:vendor')"/>
 >           <br/>Vendor URL:
 >            <xsl:value-of select="system-property('xsl:vendor-url')"/></p>
 >         </msxsl:otherwise>
 >    </msxsl:choose>
 > </xsl:otherwise>

When running on IE5, the XSL processor pays attention to the elements
with the "msxsl" prefix.  When it does so, it will never get to the
<msxsl:otherwise> element, so the <p> literal result element and the
second versions of the "Vendor: " and "Vendor URL:" literal text will
not be added to the result tree.

 > Why not just
 > <xsl:otherwise>
 >   <msxsl:if test=".">
 >   </msxsl:if>
 >     <p>Vendor: <xsl:value-of select="system-property('xsl:vendor')"/>
 >       <br/>Vendor URL:
 >     <xsl:value-of select="system-property('xsl:vendor-url')"/></p>
 > </xsl:otherwise>

This will get you an unwanted copy of the "Vendor: " and "Vendor URL:"
literal text.

 > Wouldn't that be the the same, every time your test is true it
 > will do nothing and then continue?

The real reason was that I couldn't come up with a "test" attribute
value that was always false according to the IE5 XSL processor.  I was
in a hurry, so after I tried a few things that didn't work (and got
errors about requiring a DOM node), I fell back to testing "." and
using <msxsl:otherwise> inside <msxsl:choose> for the false case.

I did mention when I posted the stylesheet to the list that I was
looking for suggestions for improvement.  Now you know why.

Regards,


Tony Graham
======================================================================
Tony Graham                            mailto:tgraham@mulberrytech.com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9632
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================



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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]