Yes, it is possible with javascript, but there's no browser-agnostic solution.
If your target browser is IE, download the XML Parser SDK from Microsoft and
study the docs.
http://www.microsoft.com/downloads/details.aspx?FamilyId=B432CD45-B7ED-4C32-A443-EC56F10EE175&displaylang=en
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email
-----Original Message-----
From: Beverly L. Parmelee <parmelee(_at_)bellsouth(_dot_)net>
Sent: Wed, 05 Nov 2003 00:09:49 -0500
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] How To Call XSL Template With Parameter From OnClick Event
I need to be able to allow users to click on a link from a summary
page and open up a detailed window based on what was chosen. How do I
call an XSL template with a parameter from an OnClick event?
Is this possible with or without javascript? I have tried many things
with no success.
In its simplest form, here's what I'm trying to do. Thanks!
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml:stylesheet type="text/xsl" href="test.xsl"?>
<INVENTORY>
<ITEM>
<ITEM_NO>1</ITEM_NO>
<SUMMARY_INFO>Summary Info</SUMMARY_INFO>
<DETAILS>
<DETAIL_INFO>Detail Info</DETAIL_INFO>
</DETAILS>
</ITEM>
</INVENTORY>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="no"/>
<xsl:template match="/">
<html>
<head>
<script language="javascript" type="text/javascript">
<!-- //
function callDetail(item_no)
{
<xsl:call-template name="detail">
<xsl:with-param name="item_input">
<xsl:value-of select="$item_no"/>
</xsl:with-param>
</xsl:call-template>
}
// End -->
</script>
</head>
<body leftmargin="0" marginwidth="0" topmargin="0">
<xsl:variable name="item_no" select="'1'"/>
<a href="#" onclick="callDetail($item_no)">
<xsl:value-of
select="INVENTORY/ITEM[ITEM_NO=$item_no]/SUMMARY_INFO"/>
</a>
</body>
</html>
</xsl:template>
<xsl:template name="detail">
<xsl:param name="item_input"/>
<html>
<head>
</head>
<body leftmargin="0" marginwidth="0" topmargin="0">
<xsl:copy-of
select="INVENTORY/ITEM[ITEM_NO=item_input]/DETAIL_INFO"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list