Subject: RE: [xsl] Problem in XSL transformation From: <Ambika.Das@xxxxxxxxxxxxxxxxxx> Date: Wed, 6 Sep 2006 14:29:04 +0530 |
Hi Davis, Thanks for the quick response. Can you please send more detailed code? And also let me know how to use XSLT2. I am using Xalan 2.7.0 as the transformer. Thanks & Regards, Ambika Prasad Das -----Original Message----- From: David Carlisle [mailto:davidc@xxxxxxxxx] Sent: Wednesday, September 06, 2006 2:18 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Problem in XSL transformation The scope of a variable binding is teh element in which it's contained so here: <xsl:variable name="inputSymbol" select="substring-after($inputSymbol,'|')"/> $inputSymbol ha steh new definition for the rest of this iteration of the body of the for-each but at the end of that iteration it will resume its original value. In writing it in this way you are asuming that a for-each will be executed in a particular order, but that is not teh case, a for-each specifies a body of code to be executed for each item in a sequence, but they may be executed in any order, and in particular in parallel. This is why declarative languages aim to be "side effect free" so that the result of execution is not changed if code is executed in a different order. instead of using for-each, apply templates to root/firstChild[1] and then have the template for each child apply templates to following-sibling::*[1], passing on the new value of the string parameter as a xsl:param. Or, if you are using xslt2, first tokenise the string then just use the string for this position directly: <xsl:variable name="strings" select="tokenize($str,'|')"/> <xsl:for-each select="root/firstChild"> <xsl:variable name="p" select="position()"/> ...<xsl:value-of select="$strings[min($p,last())]"/>... David
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Problem in XSL transforma, David Carlisle | Thread | RE: [xsl] Problem in XSL transforma, Ambika.Das |
Re: [xsl] Problem in XSL transforma, David Carlisle | Date | RE: [xsl] Problem in XSL transforma, Ambika.Das |
Month |