Subject: AW: [xsl] matching elements with no attributes From: "Zink, Juergen" <Juergen.Zink@xxxxxxxxxxxxxxxxxxxx> Date: Wed, 24 Sep 2003 13:50:43 +0200 |
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[@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@xxxxxxxxxxxxx] Gesendet am: Mittwoch, 24. September 2003 13:02 An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx 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[@part='I']"> bla </xsl:when> <xsl:when test="l[@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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Random number, Dimitre Novatchev | Thread | [xsl] xls problem with special char, Kloeck, Erwin |
Re: [xsl] matching elements with no, Emmanuil Batsis (Man | Date | Re: [xsl] matching elements with no, Elena Pierazzo |
Month |