xsl-list
[Top] [All Lists]

RE: [xsl] xml cells transformed in to a 2-d table, some table cells missing, full table required - constant variables.

2009-01-03 17:54:15

When using XSLT 1.0 I got various error messages with the 
above syntax.
XPath error : Invalid expression
if (exists($ig)) then $ig/length else 0
                 ^

Yes, sorry, I'm very out of practice with writing 1.0 code. You have to
expand the XPath if()then ...else to an XSLT xsl:choose. The exists()
function can often be replaced with boolean() or just omitted

<xsl:choose>
  <xsl:when test="$ig">
    <xsl:value-of select="$ig/length"/>
  </xsl:when>
  <xsl:otherwise>0</xsl:otherwise>
</xsl:choose>

or there's often a less verbose way, as you say here using string-length.

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--