xsl-list
[Top] [All Lists]

Re: matching elements with no attributes

2003-09-24 04:41:10
xsl:if test = "not(@*)"

Elena Pierazzo wrote:

Hi all,

Is there a way to match an element just when the element itself has no attributes?
For example, in my text I have:

<l>bla bla bla</l>
<l part='F'>bla bla</l>
<l part='I'>bla bla</l>

I want to declare different rules for <l> when it has no attributes and when he has attributes. I've tryed using
<xsl:choose>
   <xsl:when test="l[(_at_)part='I']">
       bla
   </xsl:when>

   <xsl:when test="l[(_at_)part='F']">
       bla
   </xsl:when>

   <xsl:otherwise> <-- used for an l element with no attributes -->
       bla
   </xsl:otherwise>

</xsl:choose>

but it doesn't work because I need to declare the same variable for the first xsl:when and for the xsl:otherwise.
Suggestions?
Many tanks in advance

Elena Pierazzo



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



--
Manos Batsis

    _  __    __                    __
   / |/ /__ / /____ __ _ ___ _____/ /_
  /    / -_) __(_-</  ' Y _ `/ __/ __/
 /_/|_/\__/\__/___/_/_/_|_,_/_/  \__/

http://www.netsmart.gr
mbatsis at netsmart dot gr
(+30) 210 33 02 608
(+30) 210 33 02 658
http://forte.netsmart.gr/foaf/manos_foaf.rdf




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



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