[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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"/> >
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|