[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: variables, grouping, and result-documents

Subject: Re: variables, grouping, and result-documents
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Tue, 18 Dec 2007 22:46:34 +0100
Re:  variables
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.