[xsl] How to robustly handle mutiple condition inputs in Xslt format( Previously Re:Re:How to create variable element from a couple of strings).

Subject: [xsl] How to robustly handle mutiple condition inputs in Xslt format( Previously Re:Re:How to create variable element from a couple of strings).
From: "Yang" <sfyang@xxxxxxxxxxxxx>
Date: Fri, 25 May 2001 16:37:33 +0800
Hi,  Dimitre

 Your suggestion fullfills my intention indirectly.

<xsl:value-of
select="msxsl:node-set($tempVar)/variable[@name='x1']/@select"/>

However, what I hope is able to dynamically generate  a list of variable
elements and they
can be used liked  regular variable  expressions.

May be  the best approach I can do is to hard-wire these variables which are
also pointed by mike brown.
So I drive substring-before and substring-after function to explicitly list
out the variables  from the given **string*.
such as:

<xsl:variable name="x1" select="substring-before($string,',')" />
 <xsl:variable name="x2"
select="substring-before(substring-after($string,',' ),',')" />
 <xsl:variable name="x3" select="substring-before(substring-after(
substring-after($string, ',' ), ',' ),',')" />
 <xsl:variable name="x4" select="substring-before(substring-after(
substring-after( substring-after($string, ',' ), ',' ), ',' ), ',' )" />
...

  <xsl:variable name="xn" select="substring-after(substring-after(
substring-after( substring-after(--$string,-- ',' ), ',' ), ',' ), ',' )" />

But I am still  looking  for a better solution than this type of labour
intensive work,
if possible.

The reason to keep variable value in a string is like this;
I try to simulate the  multiple WHERE  terms in a db problem
and wrapped all of the values from where condition into a string.  It is
then
to be passed as a single  augument of a Jscript  funciton which will
perform loading the xml and xsl file and  a series of
xproc.addParameter statement and then output the  transform.

All I  want is to  maintain a robust xslt code  as much as possible.
So any time when an new where condition term is required,  the criteria
value  will be
automatically wrapped into a string parameter , and I do not have to bother
to make changes of the Jscript function
in the terms of argument term  and add a new addParameter statement etc.

Is it a possible mission?  Would you provide  some insights how to  handle
multiple condition inputs
robustly  in a xslt format?

Thanks for any help in advance.


Sun-Fu Yang,

sfyang@xxxxxxxxxxxxx







 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread