Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xsl select with javascript variable.

Status
Not open for further replies.

goodgood

Programmer
Feb 15, 2001
13
IL
Hi

I need to use javascript variable as parameter to the select attribute.

<xsl:for-each select=&quot;xxxxxxxxxxx&quot;>

I want to use javascript variable instead of the xxxxxxxxxxx string.

something like :

<xsl:for-each select=MyJavaScriptVar>

Thanks in advanced
goodgood.
 
Hi Jordi

Thanks for the answer I saw it and I want to ask if the next flow is possible :

I use xml that contain link to xsl --> generate html.
and I want to add some buttons to the page (check box or something like this....) and by marking the checkbox to change the filter of the data that the xsl get.
is it posible ? can I change the xsl by javaScript & DOM that will set the xsl select=&quot;myGenericValue&quot; and to see the change ?

Thanks alot
goodgood.
 
Hi

I already solved it thanks anyway...

goodgood
 
GoodGood how did you solve the problem from your initial post.
I'm having the same thing here and have tried some techniques but no luck...

Something like:
I need to use javascript variable as parameter to the select attribute.

<xsl:for-each select=&quot;xxxxxxxxxxx&quot;>

I want to use javascript variable instead of the xxxxxxxxxxx string.

something like :
<xsl:for-each select=MyJavaScriptVar>

Where both the XSL and JavaScript are on the same XSL page itself.

Best Regards,

tia
Tarabin
 
Tarabin Hi

I use javaScript to change the 'select' attribute.

(first I add to the &quot;xsl:for-each&quot; tag attribute filter=&quot;yes&quot;)

then the javaScript go like this :

var x = xslDoc.getElementsByTagName(&quot;xsl:for-each&quot;)

for(i=0 ; i < x.length ; i++ )
if( x.item(i).getAttribute(&quot;filter&quot;) == &quot;yes&quot; )
{
x .item(i).setAttribute(&quot;select&quot;,MyJavaScriptVar)
}

Hope It Help
GoodGood
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top