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

Multiple requests with variable number of parameters

Subject: Multiple requests with variable number of parameters
From: "Siarhei Biarozkin" <sberyozkin@xxxxxxxxxx>
Date: Thu, 2 May 2002 10:59:10 +0100
multiple requests servlet
Hello,

I need to process servlet requests where the first parameter specifies a
command, and remaining ones - parameters for that command, each command
might have different number of parameters for example :
/servlet?cmd=showFile&fileID=1
/servlet?cmd=setPipLabel&pipID=1&text=BBC1

Stylesheet must convert these requests into a device-specific format, for
ex,
/servlet?cmd=showFile&fileID=1 shoud produce "Z_ShowFile 1\r>".

This is my solution ( input processing is shown only ):

device.xsl (the result of this transformation is processed by an
application ):
<xsl:stylesheet ...>
  <xsl:variable name="cmdRequest"/>
  <!-- other variables -->
  <xsl:template match="/">
    <cmd>
      <in>
          <xsl:value-of select="$cmdRequest">
          <!-- this is what all requests for this device end with -->
          <xsl:text>&#xA;&gt;</xsl:text>
      </in>
      <!-- other elements -->
    </cmd>
  </xsl:template>
 </xsl:stylesheet ...>

Each servlet request's cmd parameter is mapped to a stylesheet with the same
name
showFile.xsl :
<xsl:stylesheet ...>
  <xsl:import href="device.xsl"/>

   <xsl:variable name="fileID" select="1"/>
   <!-- thios defines a mapping-->
   <xsl:variable name="cmdRequest"
                       select="concat('Z_ShowFile ', $fileID)"/>
</xsl:stylesheet ...>

setPipLabel.xsl : similar to showFile.xsl;

What I don't like about this is that if 50 requests need to be processed,
than 50 command-specific stylesheets need to be created; I need to create 50
javax.transfrom.Templates, even though it is device.xsl which performs the
real job. Also it's quite fragile, in that each command must have a
corresponding file  named identically to its name.

Is there a better solution for this scenario ?
Thanks !
Siarhei Biarozkin


 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.