aspose file tools*
The moose likes XML and Related Technologies and the fly likes XSL - parameter passing 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 "XSL - parameter passing" Watch "XSL - parameter passing" New topic
Author

XSL - parameter passing

Brendan Kennedy
Ranch Hand

Joined: May 02, 2001
Posts: 65
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

Joined: Aug 26, 2000
Posts: 10065
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

Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Brendan Kennedy
Ranch Hand

Joined: May 02, 2001
Posts: 65
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

Joined: Aug 26, 2000
Posts: 10065
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...">
 
Consider Paul's rocket mass heater.
 
subject: XSL - parameter passing