[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Expensive XSLT2 - suggestions for improving?
Michael,
This is an interesting problem, and you may want to try a few things. Part of what makes it interesting is the question of how widely you wish to scope your examination for similar values. In XSLT 2, a third argument can be used to define the scope within which the key works. You could try something like this: <xsl:key name="oid-by-value" match="@oid" use="string(..)"/> <!-- retrieves an @oid attribute using the string value of its parent element --> and then <xsl:template match="value"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:for-each select="key('oid-by-value',.)[1] except ."> <!-- traverse to the @oid of the first element with the same value, unless this is it --> <xsl:attribute name="refoid" select="string()"/> </xsl:for-each> <!-- skip content --> </xsl:copy> </xsl:template> if you wanted to scope only within the parent element, you could use key('oid-by-value',.,..)[1] -- the '..' as the third argument restricts the scope of retrieval. Note: untested. (But if it won't work, surely some sharp-eyed XSLTer will notice.) Cheers, Wendell At 11:54 AM 10/16/2008, you wrote: Hello experts, ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|
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
|