RE: [xsl] xsk doubt [ ] vs ( )

Subject: RE: [xsl] xsk doubt [ ] vs ( )
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 25 Apr 2002 14:29:20 -0400
Speaking of variable (and other) names....

<node>
  <not>
    <mytag>
      <mytext>I'm allowed to be here!</mytext>
     <myothertext> but I'm here too!</myothertext>
    </mytag>
  </not>
</node>

<xsl:template match="node">
  <xsl:value-of select="not"/>
  <xsl:choose>
  <xsl:when test="not[. = mytag/mytext]">
    <xsl:text> I'm only where I'm supposed to be.</xsl:text>
    </xsl:when>
    <xsl:otherwise>
    <xsl:text> (I'm all over the place.)</xsl:text>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>


But ...


<xsl:template match="node">
  <xsl:value-of select="boolean(recommended)"/>
</xsl:template>

Today's lesson is "choose your names wisely", grasshopper (or you'll be jumping).

Perversely,
Wendell

At 06:56 AM 4/25/2002, Mike wrote:
> i have a basic doubt regarding conditions..
> what is the difference between saying
> <xsl:if test = "not[. = mytag/mytext]">
>
> and saying
>
> <xsl:if test = "not(. = mytag/mytext)">
>
>
> when do we use the [ ] and when do we use ( )??
> regards

[] represents a filter or predicate that you apply to a node-set
() represents the arguments to a function call

"not" is a function, not a node-set, so you need ().


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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



Current Thread