File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes parameter to xsl from java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "parameter to xsl from java" Watch "parameter to xsl from java" New topic

parameter to xsl from java

Thomas Greene
Ranch Hand

Joined: Aug 09, 2004
Posts: 127
I am sending a parameter to my xsl file from a java class using.
xformer.setParameter("lang", Language.getLocale().getLanguage());

This is my xml file

and this is my xsl file

But this xsl file does not display the param value.
Please help
Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150
The codelogic looks ok.
Did you tried to print and see the value from java before passing to xsl

also did you tried to see the value of <xsl:value-of select="$lang"/> in the beginning ?

There is also one sample program in Xalan pacakge called "XSLTWithParams" , check it for sample.

Spritle Software Blogs
Thomas Greene
Ranch Hand

Joined: Aug 09, 2004
Posts: 127
the problem was param should be before template.
I agree. Here's the link:
subject: parameter to xsl from java
It's not a secret anymore!