Subject: [xsl] Using condition expression with an empty string variable From: "Yang" <sfyang@xxxxxxxxxxxxx> Date: Thu, 21 Jun 2001 19:20:56 +0800 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] count the number of occur, Rob Lugt | Thread | Re: [xsl] Using condition expressio, Jeni Tennison |
Re: [xsl] count the number of occur, Rob Lugt | Date | Re: [xsl] Using condition expressio, Jeni Tennison |
Month |