|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] selecting elements from a flat file
Hi, I am having problems selecting a group of sibling elements from a flat file. The file is of the form... <main> <a name='Title'></a> <a></a> <a></a> <a></a> <b></b> <a></a> <a></a> <b></b> <a></a> </main> 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" use="generate-id(preceding-sibling::a[@name='Title'][1])"/> <xsl:key name="about_en" match="a" use="generate-id(following-sibling::b[1])"/> <xsl:template match="main"> <manual> <about> <xsl:apply-templates select="a[@name='Title']"/> </about> </manual> </xsl:template> <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:for-each> </xsl:template> <xsl:template match="a"> <xsl:value-of select="."/> </xsl:template> 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 Almondsbury Bristol 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






