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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to reference XML items from a Javascript function in XSLT

Status
Not open for further replies.

adhp55555

Programmer
Oct 24, 2003
9
US
Hi everyone, please help!!!
In order to display data in a popup window coded in a XSLT stylesheet, I created a javascript function, called PopupWindow(xmlTag, ddnnum) as follows:
function PopUpWindow(xmlTag,ddnnum)
{
ExtraWin = window.open("", "_blank", config='width=500,height=300,left=200,top=150');
ExtraWin.document.write(&quot;DDN Number : &quot; + ddnnum + &quot;<br></br>&quot;);
ExtraWin.document.write(&quot;XML Tag : &quot; + xmlTag);
}

And the XSLT statement to evoke this function as follows:
<td><a><xsl:attribute name=&quot;href&quot;>Javascript:popUpWindow(&quot;<xsl:value-of select=&quot;FIELDXMLTAG&quot;/>&quot;,<xsl:value-of select=&quot;FIELDDDN&quot;/>)</xsl:attribute><xsl:value-of select=&quot;FIELDDDN&quot;/></a></td>

In this XSLT statement, I passed values of FIELDXMLTAG and FIELDDDN to the function. In case I want to display 20 fields or more in the popup window, I must pass 20 values or more of XML fields to the function. It is cumbersome; therefore we need to have a way to directly reference XML fields from the &quot;popupwindow&quot; Javascript function without receiving values passed from the XSLT calling statement. Anybody knows how to do it so that the XSLT calling statement doesn't need to pass values to shorten the statement as follows:
<td><a><xsl:attribute name=&quot;href&quot;>Javascript:popUpWindow()</a></td>

Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top