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

Re: XSL Variable not getting set

Subject: Re: XSL Variable not getting set
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 14 Mar 2007 15:14:19 GMT
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

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.