Re: [xsl] Better way to change context?

Subject: Re: [xsl] Better way to change context?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 14 Oct 2004 16:41:32 +0100
> However, something bugs me. I used xsl:for-each to force the context to 
> the node pointed to by the cross-reference. It seems a little silly to use 
> a for-each statement to do that.

Not really, saxon:path() could have been designed to take an argument
specifying a node, but it isn't it just does the current node, so you
have to make what you want be the current node and for-each is used for
that purpose as often as it's used for iterating over a set of more than
one. (similar uses come up all the time with key() or xsl:number)

On the other hand I almost certainly wouldn't use an extension element
at all here. Without seeing your input and only a fraction of your
output I'm not sure what I would use, but probably xsl:number would give
you a 3.2.4 type number for chapter 3 section 2 subsetion 4 that you
could use to generate a unique filename suffix for each file.

David


________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread