[xsl] selecting elements from a flat file

Subject: [xsl] selecting elements from a flat file
From: "Adrian Jordin" <ajordin@xxxxxxxxxxxxxxx>
Date: Thu, 15 Jul 2004 15:59:03 +0100

I am having problems selecting a group of sibling elements from a flat
The file is of the form...

	<a name='Title'></a>

and I need to select all the <a> elements between <a name='Title'> and
the first <b> element.

I am trying to use keys to achieve this using the following XSL.....

<xsl:key name="about_st" match="a"

<xsl:key name="about_en" match="a"

<xsl:template match="main">
	<xsl:apply-templates select="a[@name='Title']"/>

<xsl:template match="a[@name='Title']">
	<xsl:variable name="genID" select="generate-id()"/>
	<xsl:for-each select="key('about_st', $genID)">
		<xsl:apply-templates select="key('about_en', $genID)"/>

<xsl:template match="a">
	<xsl:value-of select="."/>

The problem is that the first key selects all the <a> elements following
a name='Title'>
but the second key returns nothing.

Can someone point out where I have gone wrong? Or is there a better way
to do this?
(I am trying to do this without using XSL 2 to avoid having to install
additional software
on the customers machine.)

Many thanks,


Adrian Jordin
Senior Analyst Developer
ePublishing Department,
Piper Group plc,

Email : ajordin@xxxxxxxxxxxxxxx+

300 Aztec West
BS32 4SE

Phone + 44 (0) 1454 284900
Fax + 44(0) 1454 284950

Information contained in this e-mail is intended for the use of the
addressee only, and is confidential and may be the subject of legal
professional privilege. Any dissemination, distribution, copying or use
of this communication without permission of the addressee is strictly
prohibited. The views expressed in this communication may not
necessarily be the views held by Piper Group plc

Current Thread