[xsl] Better way to change context?

Subject: [xsl] Better way to change context?
From: JBryant@xxxxxxxxx
Date: Thu, 14 Oct 2004 10:34:58 -0500
Hi, all,

In the course of creating an HTML version of a stylesheet (I was doing 
just PDF before), I split the content into several files (one for each 
chapter). Consequently, I needed to prepend the chapter name to the anchor 
value. With some functions, that was easy enough.

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. I bet there are other (and perhaps 
better) ways to set the context for this operation.

Basically, I am curious to see how you folks would solve the same problem, 
so that I might learn something.

Here's the relevant code snippet:

    <xsl:variable name="thisChapter">
      <xsl:for-each select="key('refentries', .)">
        chapter<xsl:value-of 
select="substring-before(substring-after(saxon:path(), 'chapter['), 
']')"/>.html#
      </xsl:for-each>
    </xsl:variable>

As an aside, thanks to Michael Kay. I love Saxon.

Jay Bryant
Bryant Communication Services

Current Thread