|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Using condition expression with an empty string variab
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








