File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

parameter to xsl from java

 
Thomas Greene
Ranch Hand
Posts: 127
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 3150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Thomas Greene
Ranch Hand
Posts: 127
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the problem was param should be before template.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic