This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
xslt and xsl:if
- To: "xsl-list at mulberrytech dot com" <xsl-list at mulberrytech dot com>, "XML-L at LISTSERV dot HEANET dot IE" <XML-L at LISTSERV dot HEANET dot IE>
- Subject: xslt and xsl:if
- From: "Priya Pinto" <itfresher at rediffmail dot com>
- Date: 22 Sep 2000 06:30:26 -0000
- Reply-To: xsl-list at mulberrytech dot com
I've been working on using XML as a database and get the following xml file after deleting the childnodes of <bm> where id is b2. My XSL displays the list available along with edit and delete options but I need to ba able to check if bm has any child nodes and if not to avoid display of the deit and delete options!
XML File
<?xml version="1.0" ?>
<?xml:stylesheet type="text/xsl" href="try.xsl"?>
<bookmarks Autonumber="3">
<bm id="b1">
<title>arzoo</title>
<description>khjmhjkh</description>
<urls>http://www.arzoo.com</urls>
<category>hjjhkj</category>
</bm>
<bm id="b2">
</bm>
<bm id="b3">
<title>Mailcity</title>
<description>fgdhfgh</description>
<urls>http://www.mailcity.com</urls>
<category>jhjk</category>
</bm>
</bookmarks>
XSL File
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<style type="text/css">.input {
BACKGROUND: #ffffcc; COLOR: #000000; FONT-WEIGHT: normal
}
A.nav:link {
COLOR: #b03060; TEXT-DECORATION: none
}
A.nav:visited {
COLOR: #b03060; TEXT-DECORATION: none
}
A.nav:hover {
COLOR: #ba55d3; TEXT-DECORATION: none TEXT-SIZE: +2
}
</style>
<body bgcolor="#eed5d2" link="#eed5d2" vlink="#eed5d2" alink="#eed5d2">
<center>
<font size="5" color="#b03060">Welcome
</font>
<br/><br/>
<font size="3" color="#b03060">
Your Bookmarks!
</font>
<br/><br/>
<font size="4" color="#b03060">
Click here to
<b>
<a class="nav">
<xsl:attribute name="HREF">
http://evereadi:8080/bookmark/jsp/Addform.jsp
</xsl:attribute>
Add New Bookmark
</a>
</b>
</font>
<br/><br/>
<table>
<xsl:for-each select="bookmarks/bm">
<tr>
<td>
<input type="hidden" name="name">
<xsl:attribute name="value">
<xsl:value-of select="@id"/>
</xsl:attribute>
</input>
<b>
<a class="nav">
<xsl:attribute name="HREF">
<xsl:value-of select="urls"/>
</xsl:attribute>
<xsl:value-of select="title"/>
</a>
</b>
</td>
<td>
<b>
<a class="nav">
<xsl:attribute name="HREF">
http://evereadi:8080/bookmark/jsp/Editform.jsp?id=<xsl:value-of select="@id"/>&title=<xsl:value-of select="title"/>&description=<xsl:value-of select="description"/>&urls=<xsl:value-of select="urls"/>&category=<xsl:value-of select="category"/>
</xsl:attribute>
<img src="http://evereadi:8080/bookmark/images/edit.gif"/>
</a>
<a class="nav">
<xsl:attribute name="HREF">
http://evereadi:8080/bookmark/jsp/Delete.jsp?id=<xsl:value-of select="@id"/>&title=<xsl:value-of select="title"/>&description=<xsl:value-of select="description"/>&urls=<xsl:value-of select="urls"/>&category=<xsl:value-of select="category"/>
</xsl:attribute>
<img src="http://evereadi:8080/bookmark/images/delete.gif"/>
</a>
</b>
</td>
</tr>
</xsl:for-each>
</table>
<br/>
<br/>
</center>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Thanks
Priya
_________________________________________________
Get Your Free Email At, http://www.rediffmail.com
For fabulous shopping deals visit: http://www.rediff.co.in/shopping/index.html
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list