Jump to content

XML dont show properly


menardmam
 Share

Recommended Posts

here is the script i usehttp://www.w3schools.com/xsl/xsl_client.aspHere is the page i have done :http://www.alteraction.ca/html-ang/4-1-listedeprix4.htmlHere is my problem: when view in explorer for PC, my currency table look not that bad.... but when vien on firefox or safari it just append to add the nes table (canadian price or us price or euro price) after the existing table insted of remplacing it.... so that is not what i like... i like the table to be update on the fly...So i am pretty much there, just a little incompatibility in browser parsingPlease to fix my code, or give me another working optionThanks in advanceMarc-Andre MenardAlter Ego

Link to comment
Share on other sites

I am pretty sure there is some geek around that can help me..I have read a lot about island xml (ie only code) and javascript DOM...I think i am with the good code... just dont know when it went wrong...In fact the code i use only display the table once and is trigger as onload so the problem does not appendPlease Help !!!!!!!!!!!!!

Link to comment
Share on other sites

The code is doing two completely different things for the different browsers.

// code for IEif (window.ActiveXObject)  {  ex=xml.transformNode(xsl);  document.getElementById(tableid).innerHTML=ex;  }// code for Mozilla, Firefox, Opera, etc.else if (document.implementation && document.implementation.createDocument)  {  xsltProcessor=new XSLTProcessor();  xsltProcessor.importStylesheet(xsl);  resultDocument = xsltProcessor.transformToFragment(xml,document);  document.getElementById(tableid).appendChild(resultDocument);  }

For IE it uses the innerHTML property to assign the result text to the element. For everything else it uses the appendChild method to append the new structure (not text) to the end of the div's children. It's not removing anything, it's only adding new content. The IE code replaces what is there because IE returns text, and the DOM-compliant code appends to the parent because it returns a DOM structure, not just a bunch of text.If you want to remove what is there before you append the new table then replace the code above with this:

// code for IEif (window.ActiveXObject)  {  ex=xml.transformNode(xsl);  document.getElementById(tableid).innerHTML=ex;  }// code for Mozilla, Firefox, Opera, etc.else if (document.implementation && document.implementation.createDocument)  {  xsltProcessor=new XSLTProcessor();  xsltProcessor.importStylesheet(xsl);  resultDocument = xsltProcessor.transformToFragment(xml,document);  for (var i = document.getElementById(tableid).childNodes.length - 1; i >= 0; i--)	document.getElementById(tableid).removeChild(document.getElementById(tableid).childNodes[i]);  document.getElementById(tableid).appendChild(resultDocument);  }

Link to comment
Share on other sites

By the way.... it start from a curency table and now it a little more.... and it workthe question to you guys out ther.. doing a lot more web coding than me.... what will be your prefered choice to make the gestion of 3 tables x 3 items x 2 languageI am waiting... maybe i am the first how have this problem, but i dont beleive it.... and having 18 DIFFERENT web page does not make sens to meHELP welcome, but will keep my xml file (i love it)THANKS thanks thanks !MAM

Link to comment
Share on other sites

Another question raise to my mind.... is it possible insted of using child and so on.... to get the xml file loader into a var that is an object and access those chil node as : var mytext = ''price.xml''mytext.desc[x]mytext.price[x] (where x is the count)and have a mean to put it in a html table make with xsl (that is already working fine)So in resume, having access directly to the xml tag i have create without have to use child proprietyThanks so much in advance, and sorry to be not that geek, i just push myself into a new zone i never gone before.

Link to comment
Share on other sites

anybody know to filter.. here is the code as i try... not yet really what i am looking forhere is the xml file

				<item>						<desc lang="fra">Prepresse et entrelacement</desc>						<desc lang="ang">pre-press and interlacing</desc>				</item>				<item>						<desc lang="fra">Flip 2 images</desc>						<desc lang="ang">Flip 2 images</desc>						<prix currency="cnd">$ 450</prix>						<prix currency="us">$ 4550</prix>						<prix currency="euro">$ 4500</prix>				</item>

i like to be able to circle through the item.. ang get only des when it = angheeeeeeeeeeeeeeeelp

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...