[xsl] Multiple requests with variable number of parameters

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

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 :

Stylesheet must convert these requests into a device-specific format, for
/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="/">
          <xsl:value-of select="$cmdRequest">
          <!-- this is what all requests for this device end with -->
      <!-- other elements -->
 </xsl:stylesheet ...>

Each servlet request's cmd parameter is mapped to a stylesheet with the same
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