This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: IF-Test.....continued


Laksh--

Also, you have to create an element before you can add an attribute.

So you need something like

<xsl:template match="Book">
   <xsl:copy> <!-- copies the Book element -->
     <xsl:copy-of select="@*"/> <!-- copies the attributes it has -->

     <xsl:if test="not(@ISBN)"> <!-- adds an attribute when ISBN is missing -->
      <xsl:attribute name="NOCODE">
        <xsl:text>B01</xsl:text>
       </xsl:attribute>
     </xsl:if>
   </xsl:copy>
</xsl:template>


At 08:24 AM 3/12/2002, Mike wrote:
>Well, match="book" won't match an element called <Book>

[after you had written]

> > Well,i've enclosed the template rule which involves IF
> > test.
> >
> >
> > <xsl:template match="book">
> >       <xsl:if test="not(@ISBN)">
> >           <xsl:attribute name="NOCODE">
> >               <xsl:text>B01</xsl:text>
> >           </xsl:attribute>
> >       </xsl:if>
> > </xsl:template>
> >
> > The Book element has the following format
> > <Book NAME="book-name" AUTHOR="author-name"
> > ISBN="91-6637-401-7"/>
> >

======================================================================
Wendell Piez                            mailto:wapiez@mulberrytech.com
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]