[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Bizarre problem with MSXML4 that doesn't happen in

Subject: RE: Bizarre problem with MSXML4 that doesn't happen in MSXML3
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 11 Apr 2003 14:54:09 -0400
object bizarre
Josh,

I agree with Philip, and raise him $10. Your XSLT in general could be cleaned up, and might behave better if it were...

Instead of

<xsl:when test="count(object/data/row) > 0">
  <xsl:value-of select="/object/data/row[1]/field[@ref='f1']"/>
</xsl:when>

try test="object/data/row" (avoids count function and greater-than test, with the same result of testing true if the node exists).

Likewise, instead of
<xsl:when test="boolean(/object/securityacl)=true">
  <xsl:value-of select="/object/securityacl"/>
</xsl:when>

Just <xsl:value-of select="/object/securityac1"/> will return the value of the node if it exists, nothing if it doesn't. (The boolean test in the when is buggy, it should be test="boolean(/object/securityacl)=true()" except like the other this is quite redundant.)

In fact, the first one looks like a buggy version of the same problem as the second (there is a difference between object/data/row and /object/data/row unless your template is matching the root, which I'm guessing it is). If this is the case, you don't need the when test around the first value either.

The only reason you can't simply do

<xsl:value-of select="/object/data/row[1]/field[@ref='f1']"/>
<xsl:value-of select="/object/securityacl"/>

is that apparently these are meant to be exclusive -- and you want your 00000000 if neither of the others is there.

Scrubbed, your logic would be (assuming your template matches the root, as I'm guessing):

<xsl:choose>
  <xsl:when test="/object/data/row">
    <xsl:value-of select="/object/data/row[1]/field[@ref='f1']"/>
  </xsl:when>
  <xsl:when test="/object/securityacl">
    <xsl:value-of select="/object/securityacl"/>
  </xsl:when>
  <xsl:otherwise>00000000</xsl:otherwise>
</xsl:choose>

Which is the same as (less intelligible but more concise):

<xsl:value-of select="/object/data/row[1]/field[@ref='f1']"/>
<xsl:if test="not(/object/data/row)">
  <xsl:value-of select="/object/securityacl"/>
  <xsl:if test="not(/object/securityac1)">00000000</xsl:if>
</xsl:if>

It's worth a try,
Wendell

At 12:34 PM 4/11/2003, Philip wrote:
I'm guessing it's the same problem - just boolean() causing the problem....
Try doing the same, such as boolean(/object/securityacl/text())

___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_ "Thus I make my own use of the telegraph, without consulting the directors, like the sparrows, which I perceive use it extensively for a perch." -- Thoreau


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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.