xsl-list
[Top] [All Lists]

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

2003-04-11 11:54:09
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[(_at_)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[(_at_)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[(_at_)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[(_at_)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



<Prev in Thread] Current Thread [Next in Thread>