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

Re: extending xsl with javascript

Subject: Re: extending xsl with javascript
From: april@xxxxxxxxxxx
Date: Thu, 8 Nov 2007 15:10:00 -0500 (EST)
Re:  extending xsl with javascript
Hi Scott & Charles - Thank you!

Scott - I suspect you are right that I won't be able to acess the window object during the time of XSL processing. My kludge has been to use HTTPRequest to load the xml document, create/set attributes that act as command line parameters, perfom the transformation, and then attach the result to a <div>. The top level XSL looks like:

<xsl:template match="/">
  <!-- Get Input Variables   -->
  <xsl:variable name="DashboardMode"><xsl:value-of select="//*/@templateMode"/></xsl:variable>
  <xsl:variable name="SelectedManager"><xsl:value-of select="//*/@selectedManager"/></xsl:variable> 
  <xsl:variable name="SelectedService"><xsl:value-of select="//*/@selectedService"/></xsl:variable> 
  <xsl:variable name="SelectedFunction"><xsl:value-of select="//*/@selectedFunction"/></xsl:variable> 

<!-- Top Level 'Select Case'  -->
<xsl:choose> 
 <!-- Service Manager Dashboard -->
 <xsl:when test="$DashboardMode='Manager'">
   <xsl:call-template name="ManagerDashboard" >
    <xsl:with-param name="manager"><xsl:value-of select="$SelectedManager"/></xsl:with-param>
    <xsl:with-param name="function"><xsl:value-of select="$SelectedFunction"/></xsl:with-param> 
   </xsl:call-template>
 </xsl:when>
 <!-- Service Dashboard -->
 <xsl:when test="$DashboardMode='Service'">
   <xsl:call-template name="ServiceDashboard" >
     <xsl:with-param name="service"><xsl:value-of select="$SelectedService"/></xsl:with-param>
     <xsl:with-param name="function"><xsl:value-of select="$SelectedFunction"/></xsl:with-param> 
   </xsl:call-template>
  </xsl:when> 

  <xsl:otherwise>
    <xsl:apply-templates mode="Error" select="/"/> 
  </xsl:otherwise>
</xsl:choose>

</xsl:template>


It's pretty ugly (and needs to be refactored), but it works! The challange to this app was to keep the depolyment simple (i.e., minimize the number of files, this has a minimum of three: html, xml, and xsl) and reasonably self contained. My customer develops a niche industry application and installation of xml processing engines would have been frowned upon. Thanks all for your help.

Regards,
April

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.