Re: Conditional Assigining
Hi Sri, > <xsl:variable name="ID">-1</xsl:variable> > <xsl:for-each select="Section[parentID='0']"> > <xsl:if test="$ID=-1"> > <xsl:variable name="ID" select="sectionID" /> > </xsl:if> > id <xsl:value-of select="$ID"/> You cannot use variables in this way within XSLT. A variable's scope is limited to its following siblings and their descendants, and you cannot reassign a different value to the variable (unless you use an extension element like saxon:assign). If you want to get the value of the sectionID of that first Section element, then that's what you should set the value of the variable to: <xsl:variable name="ID" select="Section[parentID = '0']" /> I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ 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