[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSL Variable not getting set
If you Found variable is empty you output ,0 but if it is not empty, you don't use it at all, changing the end of your template to <xsl:value-of select="$Found"/> <xsl:if test="$Found = ''"> <xsl:text>,!</xsl:text> </xsl:if> </xsl:template> outputs 2007,0017016990001001703914F537,,2970.0test,3505.0test,0,0,0,123.0test,0,0,0,0,0,0 which I guess is what you want. I don't think you really neeed any xslt variables at all, something like this <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:niku="http://www.niku.com/xog/Query"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:apply-imports /> </xsl:template> <xsl:template match="niku:QueryResult/niku:Code"><xsl:text></xsl:text></xsl:template> <xsl:template match="niku:QueryResult/niku:Records"> <xsl:for-each-group select="niku:Record" group-by="@gl"> <xsl:for-each-group select="current-group()" group-by="@fiscalyear"> <xsl:if test="@fiscalyear != 'null'"> <xsl:value-of select="@fiscalyear"/> </xsl:if> <xsl:text>,</xsl:text> <xsl:if test="string(@gl) != 'null'"> <xsl:value-of select="@gl"/> </xsl:if> <xsl:text>,</xsl:text> <xsl:value-of separator="," select="for $m in 1 to 12 return (current-group()[@month=$m]/@cost,'0')[1]"/> </xsl:for-each-group> </xsl:for-each-group> </xsl:template> </xsl:stylesheet> produces: 2007,0017016990001001703914F537,2970.0,3505.0,0,0,0,123.0,0,0,0,0,0,0 David
|
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
|