[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xsl:key only checks first child, need to check all
Avoid using // (especially since you have a key already set up so you don't need to repeat the search over the whole document. Also you usually have a better experience initially writing your code for a command line or editor based engine rather than for a browser. Browsers are not really designed to report errors. This would be easier to do in two passes, but since you want it to run in firefox which doesn't have a node-set() extension, here's I one-pass solution that probably does what you want. $ saxon a.xml a.xsl <html>culture<br> -----Deloria, Ella C.<br> -----Rice, Julian<br> texts<br> -----Deloria, Ella C.<br> -----Rice, Julian<br> </html> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:key name = "topics" match = " topic " use = " . " /> <xsl:key name = "name" match = "author/name" use = "." /> <xsl:template match = "/" > <html> <xsl:for-each select = "/sources/source/topics/topic[generate-id()=generate-id(key('topics',.))] " > <xsl:sort select = " . " /> <xsl:variable name = "currentTopic" select = " . " /> <xsl:value-of select = " $currentTopic " /> <br /><xsl:text> </xsl:text> <xsl:for-each select = "key('name',key('topics',$currentTopic)/../../authors / author / name)[generate-id()=generate-id(key('name',.))]"> <xsl:sort select = " . " /> <xsl:text>-----</xsl:text> <xsl:value-of select = "." /> <br /><xsl:text> </xsl:text> </xsl:for-each> </xsl:for-each> </html> </xsl:template> </xsl:stylesheet> ________________________________________________________________________ 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 ________________________________________________________________________
|
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
|