473,320 Members | 1,902 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

problem whit script in xlst file


Hi, I have a file xml (p.xml) and I use XSLT to trasform p.xml to
XHTML.
this is the xml file:
....
<test label="x">
<itemList>
<testItem oknumber="2" >
....
</testItem>
</itemList>
</test>
.....

and this is the XSLT file:
.....
<xsl:template match="test">
<span>
<xsl:attribute name="class"> test </xsl:attribute>
<span>
<a>
<xsl:attribute name="name"><xsl:value-of
select="@label"/></xsl:attribute>
</a>
</span>
<xsl:call-template name="title"/>
<form>
<xsl:apply-templates/>
</form>
</span>
</xsl:template>

<xsl:template match="itemList">
<span>
<xsl:attribute name="class"> itemList </xsl:attribute>
<xsl:apply-templates/>
</span>
<input type= "button" class="but" value="verifica"
onclick="verify(this);" />

<script language="JavaScript">
function verify(t)
{
alert(t.tagName);
alert(t.parentNode.tagName);

}
</script>

</xsl:template>
....

the alert message should print:
"input"
"form"

In firefox all is ok, while in IE the second alert print "a".
The strange thing is that if the verify function is:
function verify(t)
{
alert(t.tagName);
alert(t.parentNode.tagName);
alert(t.previousSibling.parentNode.tagName);

}

the alert message in IE are:
"input"
"a"
"form"
Why?
I have problems with the DOM only in IE.Someone can help me, plese?
thanks

Jan 23 '06 #1
1 1395


stefano wrote:

<xsl:template match="test">
<span>
<xsl:attribute name="class"> test </xsl:attribute>
<span>
<a>
<xsl:attribute name="name"><xsl:value-of
select="@label"/></xsl:attribute>
</a>
</span>
<xsl:call-template name="title"/>
<form>
<xsl:apply-templates/>
</form>
</span>
</xsl:template> <input type= "button" class="but" value="verifica"
onclick="verify(this);" /> In firefox all is ok, while in IE the second alert print "a".


It is hard to tell exactly what goes wrong without seeing a complete
test case isolating the problem but for a start consider having the form
element inside of a div and not of a span. It might be that IE's HTML
parser tries to fix your HTML generated by the stylesheet. That is kind
of a guess to what could be one cause to the oddity you see.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 23 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sander de Maaijer | last post by:
hello i hav a little problem this is a script calles secret word when you type the secret word you get a alert whit the text:"and this is the text of the alert wehn you know the word" butt i ...
3
by: Hai Nguyen | last post by:
I would like to know after transforming my datatables which store in dataset into XML form. Now I want to save it into a file and also create a XLST file to read it. How can I do that? Would you...
1
by: Adrian | last post by:
Hi No sure if xlst is the correct choice! or if it is how I would use it from within a windows VB application! I had XML data help in an xmlelements object and I want to format the data and...
1
by: news.wanadoo.nl | last post by:
Hi, I have found whit google this form in this group. But i'n not good in javascript :(. I try and error normal but i only error now :P Whit i now want to now how can i get access to the vars...
1
by: ad | last post by:
Hi, How can I use xlst to display a xml file in asp.net?
2
by: JC | last post by:
Anybody knows what problem has this code? I think, in the Garbage Collector? You know the Solution? The program in the test's case, whit 350 contacts, run OK before number 86. The error is a...
14
by: Wouter | last post by:
Hi, I try to make the follow. I want that i can click on a text link and that then a link wil be copyed in a input form box (<input type="text" name="img_url" />). I have google-ed about how...
1
by: dave_kajinsky | last post by:
Hello all, I would like to do something with xlst, perhaps I can get help from this group? Here it goes: I've got 2 files: an ascii file and a file that identifies tokens in the ascii file. ...
12
by: viki1967 | last post by:
Good afternoon to everyone. I write this page htm with JavaScript code: <script language="javascript" type="text/javascript"> <!-- function parseNumber(val) {
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.