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

RE: xml cells transformed in to a 2-d table, some tabl

Subject: RE: xml cells transformed in to a 2-d table, some table cells missing, full table required - constant variables.
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 3 Jan 2009 22:53:46 -0000
RE:  xml cells transformed in to a 2-d table
> 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/

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.