[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] variables, grouping, and result-documents


Subject: Re: [xsl] variables, grouping, and result-documents
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Tue, 18 Dec 2007 22:46:34 +0100

Terry Ofner wrote:


The contents of the resulting documents look great. It is the resulting file names that are loopy. Here are the names of two of my resulting files:

FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL FL.fo

and

CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA CA.fo

It seems that I have this variable line in the wrong place:

<xsl:variable name="stateName" select="current-group()/@state"/>

Not in the wrong place. As long as it's in scope it is fine. But what you want is not all @state attributes in the current group's root (i.e., all <State_Standard..> elements), but only one. You can do that with current-grouping-key() or if you need another attribute:


current-group()[1]/@state


Am I trying to do too much inside this one template?

That depends on how you look at it. The processor doesn't care of course. Personally I think you should split it up and use apply-templates a bit more. But with grouping that can get a bit tricky.


Do I need two templates?

"need" is in the eye of the beholder... it doesn't really matter here if don't mind big code chunks ;)


HTH,
Cheers,
-- Abel Braaksma

PS: there's some other place where you do about the same trick, you apparently need current-group()[1] there too.


Current Thread