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

Using condition expression with an empty string variab

Subject: Using condition expression with an empty string variable
From: "Yang" <sfyang@xxxxxxxxxxxxx>
Date: Thu, 21 Jun 2001 19:20:56 +0800
condition expression
Hi,

I have applied the following condition expression successfully to my job.
And this expression pattern is suggested by Jeni back in May xsl
list.(msg00890.htm)

   [@FacilityID[string($office)]=$office]

  which   is supposed to handle situations as:
  when variable **office** is a given string,  then the condition will be
applied.
  when variable **office** is an empty string, then the condition will not
be used.

  Now I try to apply the expression to a simple case like example below,
  it does not function correctly for the given empty string,  it produces a
  set of empty nodes instead.   Why?

Would  anyone provide some suggestions?


  ** xml  **
<?xml-stylesheet href="test.xsl" type="text/xsl"?>
<docs>
<z-row FacilityID="xxx" ProductID="aaa"/>
<z-row FacilityID="yyy" ProductID="bbb"/>
<z-row FacilityID="zzz" ProductID="ccc"/>
</docs>

**  xsl ***
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>

<xsl:template match="/">
<xsl:variable name="office" select="''"/> <!-- input an empty string -->
<xsl:variable name="xx"
select="//z-row[@FacilityID[string($office)]=$office]"/>
<xsl:copy-of select="$xx"/>
</xsl:template>
</xsl:stylesheet>


  Thanks.

  Sun-fu Yang,

  sfyang@xxxxxxxxxxxxx




 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.