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

RE: xsl:variable and creating conditional select

Subject: RE: xsl:variable and creating conditional select
From: Américo Albuquerque <aalbuquerque@xxxxxxxxxxxxxxxx>
Date: Tue, 18 Mar 2003 11:05:47 -0000
xsl conditional select
Hi

> -----Mensagem original-----
> De: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] Em nome de 
> Hesselberth, Jan
> Enviada: terça-feira, 18 de Março de 2003 10:26
> Para: 'XSL-List@xxxxxxxxxxxxxxxxxxxxxx'
> Assunto:  xsl:variable and creating conditional select
> 
> 
> Hi everyone,
> I have the following logical requirement
> 
> <xsl:if test= "substring-after(.,' ')=''">
>         	<xsl:variable name="nextparent" 
> select="parent::GROUP/@CategoryOrGroupParent"/>
> </xsl:if>
> <xsl:if test= "substring-after(.,' ')!=''">
> 	 <xsl:variable name="nextparent" 
> select="concat(substring-after(.,'
> '),' ',$ROOT)"/>
> </xsl:if>
> 
> I know this won't work as the variables go out of scope. 
> However, I can't figure out how to set the expression in the 
> select of the xsl:variable to give me the required results. 
> Any help would be greatly appreciated. Cheers
> 	Jan
> 
> 

You'll have to think upsidedown (don't know if this is the right word
for this, but...), i.e., istead of setting the variable inside the
condition, do the test inside the variable.

<xsl:variable name="nextparent">
 <xsl:choose>
  <xsl:when test="substring-after(.,' ')=''">
  <xsl:value-of select="parent::GROUP/@CategoryOrGroupParent"/>
  </xsl:when>
  <xsl:otherwise>
  <xsl:value-of select="concat(substring-after(.,' '),' ',$ROOT)"/>
  </xsl:otherwise>
 </xsl:choose>
</xsl:variable>

Hope this helps


 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.