XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Sumeet BadwalSubject: Getting xsl element in javascript
Author: Sumeet Badwal
Date: 19 May 2009 04:09 PM
Hi,
I am working with a xsl file. In that I need if user clicks some row to hide and submit the page, on coming from server, that particular row should be hidden. I am adding class attribute to row, where I am displaying and hiding it. Now, before transmitting it to server. I need to see what is the attribute value. I am calling javascript function dotransmitDoc(). Following is my code :

<style type="text/css">
.disp1 { display:"block" }
.disp2 { display:"none" }
</style>

<script>
function dotransmitDoc(){
var mp_row = document.getElementsByTagName("tr")
for(var i=1; i &lt; mp_row.length; i++ )
{
if(mp_row[i].id.indexOf("MP_") == 0){
var attr = mp_row[i].getElementsByTagName("xsl:attribute")

if(mp_row[i].style.display == 'none'){
// mp_row[i].style.display = 'none'
attr[0].innerText = "disp2"
}
else
attr[0].innerText = "disp1"
}
}

}
</script>

<tr id="MP_{$MPId}_Lit_{$LitigationId}" >
<xsl:attribute name="class" id="id1" >
<xsl:if test="not($forTransmission)">disp1</xsl:if>
<xsl:if test="($forTransmission)">disp2</xsl:if>
</xsl:attribute>
.......
.......
.......
</tr>

Any help will be appreciated. Thanks in advance :)

Postnext
John BamptonSubject: Getting xsl element in javascript
Author: John Bampton
Date: 21 May 2009 11:26 AM
Hi, the XSL is run first and the HTML is created then the javascript runs. So you the bit of code in the javascript function 'xsl:attribute' will never be found.

Posttop
Sumeet BadwalSubject: Getting xsl element in javascript
Author: Sumeet Badwal
Date: 21 May 2009 12:05 PM
Thanks for your reply. But I need something like, on submitting the form, check for any hidden rows, if there is any, hide it before submitting, so after refreshing page, previously hidden row should be hidden. And javascript is in xsl file.

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.