[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] monotonous nbsp coding


Subject: RE: [xsl] monotonous nbsp coding
From: "Roger Glover" <glover_roger@xxxxxxxxx>
Date: Wed, 13 Nov 2002 21:50:37 -0600

Greg Faron <gfaron@xxxxxxxxxxxxxxxxxx> wrote:
> At 04:36 PM 11/13/2002, you wrote:
> >Greg Faron <gfaron@xxxxxxxxxxxxxxxxxx> wrote:
> > >    <xsl:if test="string-length() = 0">
> >                                 ^^ Is this a typo?
> 
>    No.  When called without an argument, the context node is 
> converted to a 
> string and used as the argument.  There are many alternative ways to test 
> whether the string value of the context node is the empty string, 
> I simply 
> carried the one that the OP used so as not to confuse the 
> reference.  Other 
> possibilities include
> string(.) = ''
> normalize-space() = ''
> normalize-space(.) = ''
> not(string(.))
> normalize-space(string-length(.)) = 0
> etc.

Right, I realized that shortly *after* I posted, but I figured I owed you the right to answer the question I asked you. :-)


>    Wendell posted "not(string())", but according to topxml.com (I know, 
> it's not the canonical source), a call to string() with no 
> arguments always 
> returns the empty string.  I haven't verified that one either way...
> 
> >Actually, I would rather put the "td" element into the named template, 
> >like so:
> 
>    I left it out in case the calling template would care to modify 
> attributes of 'td' such as rowspan or width.  Personal choice, I guess.

Point well taken.  I can see the advantage of doing it either way depending on context.

-- Roger Glover


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



Current Thread