[thelist] [XSL] Which is a better test?

Mark M mark at safefrombees.com
Sun Mar 14 18:29:21 CST 2004


Hey all - got an XSL question for you.

In my app I have a XML file that defines my site architecture with a 'section' element.
Each section element has a optional 'display' property that controls if it is displayed in the 
navbar or not.

If @display='true' it displays
If @display='false' it doesn't display
and if there is no @display, it DOES display. (So default value is true)

The question is - which is a better way to remove the @display='false' sections via XSL - 

is it:
(a)
--
<xsl:template match="section[@display='false']>
</xsl:template>

<xsl:template match="section">
    <!-- draw nav bar !-->
</xsl:template>
--

OR

(B)
--
<xsl:template match="section">
   <xsl:if test="string-length(@display)=0 or @display!='false'>
          <!-- draw nav bar !-->
   </xsl:if>
</xsl:template
--

Both work - but just curious as to which one people find 'cleaner'.

TIA.

Mark

------------------------------------------------------------------
mark at safefrombees.com
ICQ: 3094740
Safe From Bees
[ www.safefrombees.com ]





More information about the thelist mailing list