• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

XSLT Filter or Tomcat Valve?

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

Does anyone know of a Servlet Filter or Tomcat Valve that transparently executes any client side stylesheet transformation for those clients that are not capable of XSLT?

Thanks for any pointer.

Regards,

Andreas
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds nifty ... um, but how would you know if a client is able to do transformations client-side? I'm not aware of any HTTP header (or use thereof) that would allow you to determine this.
 
Andreas Schildbach
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you can determine it from the user-agent header: IE6 and Firefox are capable of client-side-transformation. Sure enough, the logic would need maintenance from time to time.

Regards,

Andreas
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IE6 can always do transformations? I was under the impression that you could only do it after you downloaded the MSXML stuff. Either way, it doesn't sound too complicated ... 10 lines of code maybe? I'm not aware of any filters floating around that already attempt to do this, but I may be wrong -- it happens.
 
Andreas Schildbach
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I can't remember that I ever installed MSXML, and it works.
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I donot know of any Servlet Filter or Tomcat Valve which comes bundled.


But, I dont think it would be hard to write a filter yourself. Maybe something on these lines....









public class XSLTFilter implements javax.servlet.Filter
{


.......


public void doFilter( request, response, filterchain )
{

/* Logic to check whether xslt transformation would be required goes here */

if ( XSLTFormattingRequired )

{
/* javax.xml.transform.* */

transformer.transform( transformSource, result ) ;
}


filterChain.doFilter( req, resp ) ;


}

}








}
 
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Ajith And Ajith And:
But, I dont think it would be hard to write a filter yourself. Maybe something on these lines....


Priceless. Would you care to suggest an implementation for XSLTFormattingRequired (a method, presumably?) or if not (then a boolean) for the method that sets its value?

Jules
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!