cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass value to xslt param dynamically using xml query template?

0 Kudos

I need to pass a param value to xslt dynamically using xml query template.

I have xml query, where I am using xslt transformation.

Now I need to set the xslt param(SelectName) value as query's [Param.1].

How can I do this.

I have this code in my xslt file:


<xsl:param name="*SelectName*"/>     

<xsl:template name="description"  match="/">
	
	<xsl:for-each select="Rowsets/Rowset/Row[Unit='$*SelectName'*]">	
.
.
.	

Accepted Solutions (1)

Accepted Solutions (1)

jcgood25
Active Contributor
0 Kudos

What is your xml query URL? For simplicity sake I would eliminate the asterisks and just keep the xsl param name simple text.

Have you tried appending &SelectName=XXX in your URL?

0 Kudos

My xml query url is:

http://uscinc1b5s3:52000/XMII/Illuminator?QueryTemplate=BPCL_Refinery_Demo%2FQuadrant%2FQueryTemplat...

I tried using &SelectName='[Param.1]' in the end of xslt url.

jcgood25
Active Contributor
0 Kudos

Is it safe to assume you're using your xslt as the stylesheet in an IRPT SERVLET call?

Given the sample URL for the XMLQuery template you can add a line like this to your SERVLET section:

<PARAM NAME="Param.1" VALUE="xxx">

Or since the SERVLET is calling the Illuminator servlet, you can skip this in the query template and just use:

<PARAM NAME="SelectName" VALUE="xxx">

*************************************************************************************************

Consider the folowing example, which uses the built in /XMII/Stylesheets/IllumList.xsl which contains an xsl param called ListSize to control the html select attribute for size (1 becomes a drop down box, and sizes greater become scrolling list boxes)

In a blank IRPT page add:

<SERVLET NAME="Illuminator">
<PARAM NAME="Server" VALUE="Simulator">
<PARAM NAME="Mode" VALUE="TagList">
<PARAM NAME="Content-Type" VALUE="text/xml">
<PARAM NAME="ListSize" VALUE="{HowBig}">
<PARAM NAME="StyleSheet" VALUE="/XMII/Stylesheets/IllumList.xsl">
</SERVLET>

Save the page and call it In a browser like this:

...TestPage.irpt?HowBig=5

Former Member
0 Kudos

Hi Jeremy,

Me too got the same kind of requirement as Snehal.

I think i cant use an Servelet from irpt page.Since i need to get XSLT applied on top of my XML query whose XML values I am going to use in the page.

Please suggest if there is a way of doing it.

abesh
Contributor
0 Kudos

Agree with what Jeremy has said in his post. Apart from that I noticed a typo in your code :


	<xsl:for-each select="Rowsets/Rowset/Row[Unit='$*SelectName'*]">	

should be


	<xsl:for-each select="Rowsets/Rowset/Row[Unit='$*SelectName*']">	

?

Check the quotes for $SelectName ?

Answers (0)