Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Comparing a variable's value in xsl choose

From: "Joe Fawcett" <joefawcett@---------.------>
To: 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? 



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent