Subject: [xsl] XSL And Checkboxes with javascript reference problem From: "Frans Herbst" <fherbst@xxxxxxxxxxxxx> Date: Tue, 8 Oct 2002 22:07:51 +0200 |
Hi All, I have a problem with the following: I have a stylesheet showing data from an xml source: <?xml version="1.0"?> <rs> <entity id="e1" all="y" descr="All Details" n="1" sel="true"> <contents> <entity id="e2" cb="y" descr="Branch - 1"> <contents> <entity id="e3" cc="y" descr="Sub Branch a"/> <entity id="e4" cc="y" descr="Sub Branch b"/> </contents> </entity> <entity id="e5" cb="y" descr="Branch - 2"> <contents> <entity id="e6" cc="y" descr="Sub Branch a"/> <entity id="e7" cc="y" descr="Sub Branch b"/> </contents> </entity> </contents> </entity> </rs> The xsl Stylesheet: <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" language="JavaScript"> <xsl:template match="rs"> <xsl:apply-templates select="entity"/> </xsl:template> <xsl:template match="entity"> <div onclick="window.event.cancelBubble = true;clickOnEntity(this);selectitem(this)" onselectstart="return false" ondragstart="return false"> <xsl:if match=".[@all='y']"> <xsl:attribute name="image">images/book.gif</xsl:attribute> <xsl:attribute name="imageopen">images/bookopen.gif</xsl:attribute> </xsl:if> <xsl:if match=".[@cb='y']"> <xsl:attribute name="image">images/book.gif</xsl:attribute> <xsl:attribute name="imageopen">images/bookopen.gif</xsl:attribute> </xsl:if> <xsl:if match=".[@cc='y']"> <xsl:attribute name="image">images/space.gif</xsl:attribute> <xsl:attribute name="imageopen">images/space.gif</xsl:attribute> </xsl:if> <xsl:attribute name="open">false</xsl:attribute> <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute> <xsl:attribute name="name"><xsl:value-of select="@descr"/></xsl:attribute> <xsl:attribute name="STYLE"> padding-left: 20px; cursor: hand; <xsl:if expr="depth(this) > 2"> display: none; </xsl:if> </xsl:attribute> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="middle" nowrap="true"> <img border="0" id="image"> <xsl:attribute name="SRC"> <xsl:if match=".[@all='y']"> images/book.gif </xsl:if> <xsl:if match=".[@cb='y']"> images/book.gif </xsl:if> <xsl:if match=".[@cc='y']"> images/space.gif </xsl:if> </xsl:attribute> </img> </td> <td valign="middle" nowrap="true" id="branchboxid"> <input type="checkbox" name="branchbox" checked="true"> <xsl:attribute name="checked">checked</xsl:attribute> </input> </td> <td valign="middle" nowrap="true"> <xsl:attribute name="STYLE"> padding-left: 7px; font-family: Verdana; font-size: 11px; font-color: red; </xsl:attribute> <font class="samespace"><xsl:value-of select="@descr"/></font></td> </tr> </table> <xsl:apply-templates select="contents/entity"/> </div> </xsl:template> </xsl:stylesheet> function initialize() { var xmlDoc var xslDoc xmlDoc = new ActiveXObject('Microsoft.XMLDOM') xmlDoc.async = false; xslDoc = new ActiveXObject('Microsoft.XMLDOM') xslDoc.async = false; xmlDoc.load("tree/ROLUP_13200210031612.XML") xslDoc.load("tree/rollup.xsl") folderTree.innerHTML = xmlDoc.documentElement.transformNode(xslDoc) } function clickOnEntity(entity) { alert(entity.checked); if(entity.open == "false") { expand(entity, true) } else { collapse(entity) } window.event.cancelBubble = true } With this in an asp page the user gets a drilldown list. The problem is that I cannot reference to the checkbox. clickOnEntity(this) where (this) does not contain any information about the checkbox - I need to check in this javascript if the entity checkbox is selected or not. I tried adding a attibute at the top including <xsl:attribute name="checked">false</xsl:attribute> but then the value returned is always false. Hope somebody can help, I have been searching for three day's to resolve this problem. What I want to achieve is that once a user clicks on the first checkbox, all the other checkboxes must be selected or deselected according to the first level, then if the first level is deselected, the second level can be activated with it's children. Regards Frans Herbst XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] multiple xml files, Kevin Collins | Thread | [xsl] Using document(), Adam van den Hoven |
RE: [xsl] multiple xml files, Kevin Collins | Date | [xsl] Using document(), Adam van den Hoven |
Month |