Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Comparing a variable's value in xsl choose [Thread Next] Re: Comparing a variable's value in xsl chooseTo: NULL Date: 11/22/2008 10:37:00 AM In general you can't work with XSLT in this way. One reason is that for-each is not 'a loop'. It processes all the nodes chosen, maybe all at once or in reverse order, that is processor dependent and is a black box. What you need to do is re-phrase the question in a functional manner. For example it maybe necessary to group the nodes first and/or use only distinct values. If you are using XSLT 2.0 this is easy, with version 1.0 you can use Muenchian grouping. -- Joe Fawcett (MVP - XML) http://joe.fawcett.name "smartnhandsome" <smartnhandsome@g...> wrote in message news:7375505b-10ae-4913-a38f-327997753f10@v...... > Hi every one, > I have a simple variable comparison to be done in loop <xsl:for-each > and i have to compare a value from an xml document from a previous > value. I.e the xml tags might contain duplicates so i am comparing the > previous value from the current value to be converted into a pdf > document. I have two problems how do keep track of previous value > using a variable or other wise and how to use xsl choose i am doing > some thing like this. > > <xsl:variable name="PRGPIDP" select="'jk'"/> > <xsl:for-each select="itemMovementListsReport/ > ItemMovementListsReportGroupEntry"> > > <xsl:when test="$PRGPIDP eq PRGPID"> > <fo:table-cell text-align="right"><fo:block><xsl:value- > of select="$PRGPIDP"/></fo:block></fo:table-cell> > </xsl:when> > <xsl:otherwise> > <fo:table-cell text-align="right"><fo:block><xsl:value- > of select="PRGPID"/></fo:block></fo:table-cell> > </xsl:otherwise> > </xsl:choose> > > <xsl:variable name="PRGPIDP" select="PRGPID"></xsl:variable> > </xsl:for-each> > > The variable i am using is also not being reset, can any one please > let me know any other ideas? | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
