File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XSL - parameter passing

 
Brendan Kennedy
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,
Is there any way in which you can specify that any number of parameters can be passed to your xsl and that they all will be processed in the same way, ie have a generic parameter that you can have one template for.
I have some xsl that generates a table. I want to check if the parameters are the same as the column headers, then the contents will become a link.
Thanks,
Brendan.
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am almost sure it cannot be done in "ordinary" XSLT stylesheet. However, any problem can be solved by introducing another level of indirectness. You can put your parameters in XML file and then read it in your XSLT. Or maybe this utility will help:
Jeni's Select Parameters Utility http://www.jenitennison.com/xslt/utilities/selectParameters.html
 
Brendan Kennedy
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey
Ye, I've heard of passing in a node set as a parameter. How is this done? Is it possible to simply import another xml file into your transformation and do your checking against it?
Thanks,
Brendan
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use document() function. For example, read the whole file in a variable
<xsl:variable name="myVar" select="document('myXML.xml')"/>
and then you can use it where you want,
<xsl:for-each select="$myVar/rootElement/anotherElement...">
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic