Advertisement

02.20.2008 at 12:12PM PST, ID: 23178983
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

XSLT transformation problem in Firefox with anchors at link

Tags: XSLT, Firefox
Hi,

I am developing a page that needs to transform a XML and a XSL into HTML.
The code is working fine, at both Internet Explorer and Firefox.
But if my page location has an anchor on it(eg. www.site.com/#myanchor), it stops working at Firefox.

The code is just below, at the Code Snipped Box.

As I said, it works fine on both browsers, but just without anchors at link. So if I type www.mysite.com/ at my browser, it works fine.
But if I type www.mysite.com/#omg, it doesnt work in firefox.


Can anyone help?

Thanks in advance.
1:
2:
3:
4:
5:
6:
7:
var vv = new DOMParser();
var xsl2 = vv.parseFromString(xslString, "text/xml").documentElement;
var xml2 = vv.parseFromString(xsmlString, "text/xml").documentElement;
var xslp = new XSLTProcessor();
xslp.importStylesheet(xsl2);
var fobj = xslp.transformToFragment(xml2, document);
document.getElementById(target).appendChild(fobj.firstChild);
Start your free trial to view this solution
Question Stats
Zone: Web Development
Question Asked By: alexgcm
Solution Provided By: alexgcm
Participating Experts: 2
Solution Grade: A
Views: 33
Translate:
Loading Advertisement...
02.20.2008 at 11:42PM PST, ID: 20945756

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.21.2008 at 07:11AM PST, ID: 20948381

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.21.2008 at 07:43AM PST, ID: 20948726

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.21.2008 at 09:43AM PST, ID: 20949985

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.29.2008 at 12:37PM PST, ID: 21017298

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.02.2008 at 03:42PM PST, ID: 21028193

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.02.2008 at 03:45PM PST, ID: 21028208

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.03.2008 at 03:37PM PST, ID: 21036876

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • Automotive
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Displays / Monitors
  • Handhelds / PDAs
  • Components
  • Peripherals
  • Laptops/Notebooks
  • Servers
  • Misc
  • Apple
  • Embedded Hardware
  • Networking Hardware
  • Storage
  • Desktops
  • New Users
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMware
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Virtualization
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • Web Computing
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Consulting
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMware
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Automation
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Web Services
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Web Computing
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Lounge
  • Business Travel
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
  • Automotive
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
02.20.2008 at 11:42PM PST, ID: 20945756

Rank: Master

Hi Alex,

We'll need a little bit ore information to help you with this. I.e.:

  - Is the anchor located in the part you created with XSLT or in the part that is static?
  - If you say "it" doesn't work, what do you mean with "it": the XSLT transformation or the browser going to the anchor on the page?
  - If the anchor is created with XSLT, can you show the relevant parts of the XSLT (or the XSLT in full)?
  - You refer specifically to firefox, what is the expected behavior and does that work well in IE, Opera etc?
  - How do you invoke the script above: through a (click) event, on other user action (i.e., typing a text), or on loading the page?
  - Are there other builder scripts that may create or destroy the anchor?

Please update so that I / We can help you further.

Cheers,
-- Abel --
 
02.21.2008 at 07:11AM PST, ID: 20948381
Hi Abel,

thanks for your help. Answering your questions:

1- There is no anchor(<a name="">) in the page. The problem is when I put the # in the URL. I use that to do history control with ajax
2- What doesnt work is the XSL transformation when there is a # at the URL
3- The XSLT doesnt create anchors, there are no anchors in the HTML
4- Didnt tested it at Opera yet, but it works fine at ie
5- I invoke the script at the onLoad page, but tested it with the onclick event either. There is a engine that verifies the URL typed at the browser and load that fragment inside a div. For example, if the user type www.mysite.com/#Alex, it loads data about alex inside a div in the page. If the user type www.mysite.com/#Bruno it loads data about Bruno(something similar to the GMail history control)
6- No


I made a simple page to teste that behavior with the onclick event(example.aspx was the name of the page).
The XSL transformation was working fine. But if I access the page passing an anchor name to it(example.aspx#Alex), it stops working at firefox. Even if I put a <a name="Alex></a> at the page.
 
02.21.2008 at 07:43AM PST, ID: 20948726

Rank: Master

Hi Alex,

Hmm, I'm thinking of a couple of causes that might be the result of the behavior you are experiencing, but none seem to be a total fit to your story. However, before I try to completely reproduce your problem locally, I have a couple of things I like to share with you about your current design, provided I understand your tellings well enough.

Using an anchor to control the history (you mean the cache of the browser? Or do you mean the back-browse feature of a browser to accommodate for history problems in dynamic AJAX applications?) is a debatable use of the anchor. An anchor is meant to instruct the browser and it will, for instance, not instantiate a new load of the same page. Instead, it will try to locate the element with id="#anchor", or an element <a name="anchor"></a> and scroll there.

As an alternative and possibly as a better solution (i.e. to re-invoke the onload) you should consider using the querystring instead (i.e, any part behind the question mark on the link, like http://example.com/test?div=Bruno). A query string is easier to locate does not give any side effects, apart from a browser visit to the server of course.

If the latter is a problem, there are sufficient other solutions, like passing parameters to and from the XSLT to pass on information, but to help you there I need to understand your project a bit more.

Regardless, this won't change the situation (seemingly) that once you have an anchor the XSLT seems to break, even when in an onclick (I understand the onload fails, but the onclick???). I'll have to try that out, because I am sure I have dozens of pages that fit the description of your problem with XSLT, anchors, queries etc, without any problem whatsoever.

One more question left unanswered: do you get any errors or is the script not invoked at all? At what line in your code above (or your own code) does it stop working? Can you check the JavaScript console on Firefox?

Cheers,
-- Abel --
 
02.21.2008 at 09:43AM PST, ID: 20949985
Hi Abel,


The History Control is meant to enable the back-browser feature and bookmarks.

I can't use the query string, because the page can't be entire loaded again. (and I don't know a way to use the query string in the url and don't load the entire page again, is that possible?)

The Javascript console doesn't return any errors at all.

I am posting some images to show whats happening. The window.jpg file shows 4 Firefox screens, 2 without the anchor on the link, and 2 with it. As you see, in the second case, the firefox doesnt transform my xml, and just show it.
The other 2 images are codes. I use a framework to do this, and the code part of the framework that transforms the xml is at the code snippet box.

Thanks for helping.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
var vv = new DOMParser();
			var xsl2 = vv.parseFromString(xslrequest.XSLResponse, "text/xml").documentElement;
			var xml2 = vv.parseFromString(xslrequest.XMLResponse, "text/xml").documentElement;
			var xslp = new XSLTProcessor();
			if(xslrequest.Parameters!=null) {
				for(var i=0; i<xslrequest.Parameters.Values.length; i++) {
					xslp.setParameter(null, xslrequest.Parameters.Values[i][0], xslrequest.Parameters.Values[i][1]);
				}
			}
			xslp.importStylesheet(xsl2);
			var fobj = xslp.transformToFragment(xml2, document);
			if(xslrequest.Target!=null) {
				try {
					$(xslrequest.Target).removeChild($(xslrequest.Target).firstChild);
				} catch(e) {}
				$(xslrequest.Target).appendChild(fobj.firstChild);
			}
Open in New Window
 
The testxsl.aspx file
The testxsl.aspx file
 
 
The testtemplate.xsl file
The testtemplate.xsl file
 
 
Firefox behavior
Firefox behavior
 
 
02.29.2008 at 12:37PM PST, ID: 21017298
I could manage to solve this bug by now.

The pages I did have some strange behaviors, but for now they are working.
I'll keep testing to see if they keep working fine.

I found the solution to this problem here:
https://bugzilla.mozilla.org/show_bug.cgi?id=212362

It is a FF BUG.
Accepted Solution
 
03.02.2008 at 03:42PM PST, ID: 21028193

Rank: Master

Well done! I'm sorry to only attend back to this question by now. If this resolves your question you should ask for a refund of the points as you have found the resolution yourself.

Cheers,
-- Abel --
 
03.02.2008 at 03:45PM PST, ID: 21028208

Rank: Master

I just received the warning about the deletion process (and apparently I interrupted the automated process??). Go ahead with the deletion, I have no objections whatsoever.
 
03.03.2008 at 03:37PM PST, ID: 21036876
A request has been made in Community Support to close this question:
http://www.experts-exchange.com/Q_23208120.html

If there are no objections, a moderator will finalize this question in approximately 4 days as follows:
Accept expert comment {http:#a21017298}

Please leave any recommendations here.

kb
Experts Exchange Moderator
 
 
03.07.2008 at 06:03AM PST, ID: 21069985
Force accepted.
modus_operandi
EE Moderator
 
 
 
20080716-EE-VQP-33 / EE_QW_2_20070628