• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Attn. XSLT: Html with namespaces!!!

 
Subhadip Chatterjee
Ranch Hand
Posts: 93
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks,
i have an interesting problem here...I am using IBM WSAD 5.1.2 in WinXP machine for developing and deploying my web project. Now, i have got some XSL parsing to do, so i am using WSAD runtime "j2ee.jar" to get the "Transformer" class, and parse the response-XML into HTML using an XSL file.Let's say, i have to populate a combo-box, and after trasforming the data it's displaying the HTML code as:
<?xml version="1.0" encoding="UTF-8"?>
<option value=""/>
<option value="05">Red</option>
...
but when i am deploying this project into an AIX machine with WAS 5.0.1,after transformation, it's displaying like:
<?xml version="1.0" encoding="UTF-8"?>
<option xmlns:q1="urn1" xmlns:q0="urn2" xmlns:SOAP- ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:fo="http://www.w3.org/1999/XSL/Format" value=""/>
<option xmlns:q1="urn1" xmlns:q0="urn2" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:fo="http://www.w3.org/1999/XSL/Format" value="05">Red</option>

You can see the difference...in the latter case, it's printing whole URNs. This leads to increase in page size for UIs. Please suggest me how to stop printing the URNs on page.
 
Paul Clapham
Sheriff
Pie
Posts: 20208
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I'm lost. Who is generating these files and when? You've got deploying and transformation going on there. Are those separate steps, or is the transformation part of the deployment? And which one is causing the problem? If it's the transformation, what environment is it running in? WSAD or something else?
 
Subhadip Chatterjee
Ranch Hand
Posts: 93
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok...i can only understand what garbage i've written...let's explain again...for UI display, i have to parse some XML using XSLT, and print the HTML output on UI...for a moment forget about any deployment junk. This transformation is happening in IBM WSAD 5.1.2 environment & WIN-XP machine.If i see the parsed HTML on browser screen, it's displaying like thislet's say for a combo-box)
<option value="10">Active</option>
<option value="20">Low</option>
...

Now, the production environment is AIX machine & we have WAS 5.0.1 as server. So, when i deploy the application there, open it from browser and see the HTML source of any UI screen, i see like this:
<option xmlns:xs="urn1" xmlns:fo="urn2" xmlns:xdt="urn3" xmlns:m0="urn4" value="10">Active</option>
<option xmlns:xs="urn1" xmlns:fo="urn2" xmlns:xdt="urn3" xmlns:m0="urn4" value="20">Low</option>
...where urn1,urn2 etc. are valid URL strings.

Now, my question is, why does it show onny afer deploying onto AIX machine?
and secondly, how to remove the namespaces from HTML output?
 
Paul Clapham
Sheriff
Pie
Posts: 20208
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So here's the process, as I understand it from that reply:

1. In WSAD on your Windows box you run an XSLT transformation that generates some HTML code. The resulting HTML doesn't have those namespaces in it.

2. You deploy that HTML to an AIX box running WAS.

3. When WAS on AIX returns the HTML in response to a request, the result has those namespaces.

If that's the process, I don't see why you are focusing on the XSLT when it's the only one of the three steps that is demonstrably correct.

Does the deployment change the HTML? Check that out. If it does then that's your problem. If it doesn't, then WAS is inserting the namespaces and that's your problem.
 
Subhadip Chatterjee
Ranch Hand
Posts: 93
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,
I got it fixed...i didn't have the option to check the AIX machine & WAS running on it, as it's the LIVE application...so, what i did, i found a quite interesting attribute of <xsl:stylesheet>. it's "exclude-result-prefixes" in which you can mention all the unnecessary namespaces to be excluded from output HTML...i used it in all the XSL-files, and it's now working perfectly both in Windows & AIX server...i thought i wanna share this with you.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic