Subject: Re: [xsl] XSL Variable not getting set From: David Carlisle <davidc@xxxxxxxxx> Date: Wed, 14 Mar 2007 15:14:19 GMT |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSL Variable not getting , Abel Braaksma | Thread | [xsl] fo spaces, Mati Hadi |
Re: [xsl] XSL Variable not getting , George Cristian Bina | Date | RE: [xsl] XSL Variable not getting , Michael Kay |
Month |