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

Re: How to robustly handle mutiple condition inputs in

Subject: Re: How to robustly handle mutiple condition inputs in Xslt format( Previously Re:Re:How to create variable element from a couple of strings).
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Fri, 25 May 2001 10:50:03 +0100
xsl if mutiple condition
Hi Sun-Fu,

> 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*.

What about building an XML structure to hold the values, converting
that to a node set, and then indexing into that when you want to use
the 'variables'?

So something like:

<xsl:template match="/">
   <xsl:variable name="variables-rtf">
      <xsl:call-template name="decompose">
         <xsl:with-param name="s" select="$string"/>
         <xsl:with-param name="nx" select="$vname"/>
      </xsl:call-template>
   </xsl:variable>

   <xsl:variable name="variables"
                 select="msxsl:node-set($variables-rtf)/variable" />

   <xsl:value-of select="$variables[@name = 'x3']" />
   
</xsl:template>

<xsl:template name="decompose">
   <xsl:param name="s" />
   <xsl:param name="nx" />
   <xsl:if test="string($s)" >
      <variable name="{substring-before($nx, ',')}">
         <xsl:value-of select="substring-before($s,',')"/>
      </variable>
      <xsl:call-template name="decompose">
         <xsl:with-param name="s" select="substring-after($s,',')"/>
         <xsl:with-param name="nx" select="substring-after($nx,',')"/>
      </xsl:call-template>
   </xsl:if>
</xsl:template>

Although if you're calling it from Javascript, you could always pass
in $variables directly as a parameter (you can have an RTF parameter
if you use Javascript to access MSXML).

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 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.