Jump to content

XSLT in changing the value of a variable...


macaroni

This topic is 7002 days old. Please don't post here. Open a new topic instead.

Recommended Posts

What I am attempting to do is to display the category heading if they are different from the previous record.

i.e.

Category Heading 1

Record

Record

Record

Category Heading 2

Record

Record

Category Heading 3

Record

.

.

So I figured to use 2 <xsl:variables>, one to keep track of the current record's category heading and another 1 to keep track of the previous record's category heading. The current record category heading is placed in a <xsl:variable name="category">. This is found in the <xsl:for-each select="/filemaker:FMPDSORESULT/filemaker:ROW"> tag. This works correct however the problem is when the variable that keep tracks of the previous record category.

I figured to use ^_^

<xsl:variable name="prev_category"><xsl:value-of select="/filemaker:FMPDSORESULT/filemaker:ROW[$d]/filemaker:category" /></xsl:variable>

where $d = position() -1;

Value of $d is correct but the value of prev_category is always set to the first category heading of the first record.

I am wondering why the code is not working of saving the state of previous record's category heading.

How can I implement this...

Thanks.

Link to comment
Share on other sites

  • 1 year later...

You should look at "Grouping Using the Muenchian Method". A very good example of XSLT grouping is on Jeni Tennison's site <a href="http://www.jenitennison.com/xslt/grouping/index.html">http://www.jenitennison.com/xslt/grouping/index.html</a>.

Link to comment
Share on other sites

You should look at "Grouping Using the Muenchian Method". A very good example of XSLT grouping is on Jeni Tennison's site <a href="http://www.jenitennison.com/xslt/grouping/index.html">http://www.jenitennison.com/xslt/grouping/index.html</a>.

Link to comment
Share on other sites

You should look at "Grouping Using the Muenchian Method". A very good example of XSLT grouping is on Jeni Tennison's site <a href="http://www.jenitennison.com/xslt/grouping/index.html">http://www.jenitennison.com/xslt/grouping/index.html</a>.

Link to comment
Share on other sites

This topic is 7002 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.