xsl-list
[Top] [All Lists]

xsl:for-each result

2005-03-04 10:31:16
I'm binding the result of for-each to a variable like this:

    <xsl:variable name="title-suffix">
      <xsl:for-each select="relation_list/relation[(_at_)class='REP']">
        <xsl:call-template name="title-suffix">
          <xsl:with-param name="relation" select="."/>
        </xsl:call-template>
      </xsl:for-each>
    </xsl:variable>

My problem arises when no nodes match the select expression and so the
title-suffix template isn't called.  Shouldn't the title-suffix variable
be bound to an empty sequence, whose effective boolean value is false?

I try to detect that situation in this instruction:

    <xsl:call-template name="data-element">
      <xsl:with-param name="code" select="'TL'"/>
      <xsl:with-param name="value"
         select="if ($title-suffix)
                 then substring(concat($title, ' ', $title-suffix), 1, 304)
                 else $title"/>
    </xsl:call-template>

But my tests indicate that the title-suffix variable is a seqence of 1
node, an empty text node I think.  What is the explanation for that, and
how should I test for the empty suffix?

Thanks,
-- 
Kevin Rodgers


--~------------------------------------------------------------------
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>
--~--



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