[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: How To Call XSL Template With Parameter From OnCli

Subject: RE: How To Call XSL Template With Parameter From OnClick Event
From: cknell@xxxxxxxxxx
Date: Wed, 05 Nov 2003 09:36:20 -0500
call template with parameter
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@xxxxxxxxxx - email



-----Original Message-----
From:     Beverly L. Parmelee <parmelee@xxxxxxxxxxxxx>
Sent:     Wed, 05 Nov 2003 00:09:49 -0500
To:       XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject:   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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.