xsl-list
[Top] [All Lists]

AW: matching elements with no attributes

2003-09-24 04:50:43
Hi Elena,

most probably you are on the wrong level.
Suppose you have an template matching the
element "l". You didn't show the code!

<xsl:template match="l">
<xsl:choose>
    <xsl:when test="l[(_at_)part='I']">
===================>Here you assume l has an element l
===================>match the attribute directly
    <xsl:when test="@part='I'">
...

Cheers,

Juergen

-----Ursprüngliche Nachricht-----
Von: Elena Pierazzo [mailto:pierazzo(_at_)ital(_dot_)unipi(_dot_)it]
Gesendet am: Mittwoch, 24. September 2003 13:02
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Betreff: [xsl] matching elements with no attributes

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


*****************************************************************************
Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte 
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese 
eMail irrtuemlich erhalten haben, informieren Sie bitte sofort den 
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren 
sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. 
If you are not the intended recipient (or have received this e-mail 
in error) please notify the sender immediately and destroy this e-mail. 
Any unauthorized copying, disclosure or distribution of the material 
in this e-mail is strictly forbidden.
*****************************************************************************


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



<Prev in Thread] Current Thread [Next in Thread>
  • AW: matching elements with no attributes, Zink, Juergen <=