<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<!-- lookup port parent on portfolio long name *** uses parsed
portparent_lkup xml file -->
<xsl:key name="client_key_lkp" match="atl_client" use="client_key"/>
<xsl:template match="/">
<xsl:variable name="unique_client_recs"
select="atl_clients_load/atl_client[generate-id(.)=generate-id(key('client_k
ey_lkp',client_key[1]))]"/>
<client_recs>
<xsl:for-each select="$unique_client_recs">
<client_key>
<xsl:value-of select="$unique_client_recs"/>
</client_key>
</xsl:for-each>
</client_recs>
</xsl:template>
</xsl:stylesheet>
Here is a sample of the structure and my desired result is to return all of
the atl_elements that have a unique client_key element value.
(e.g. <atl_load>123</atl_load>
<atl_load>124</atl_load>
<atl_loads>
<atl_load>
<client_key>123</client_key>
....
</atl_load>
<atl_load>
<client_key>123</client_key>
....
</atl_load>
<atl_load>
<client_key>124</client_key>
....
</atl_load>
<atl_load>
<client_key>124</client_key>
....
</atl_load>
*** 45000 more of these atl_loads elements in my document
</atl_loads>
I would appreciate any input on this.
Larry R.
"LarryR" <rubin...@cox.net> wrote in message
news:SIGNb.2673$dd6.1001@lakeread02...
Thank you for your response, Sergey
LarryR
"Sergey Dubinets" <sd...@online.microsoft.com> wrote in message
news:uXvspoS5...@TK2MSFTNGP10.phx.gbl...
> I have submitted this issue to Microsoft support. I am interested to here
> what they say and when the sp1 release of 1.1 is available or if they have
> other workarounds for deriving a unique list.
I've been experimenting with set:distinct() function of EXSLT as an
alternative for Muenchian method in .NET. You may want to try it instead
and measure. Please post results here, it's interesting to see real use
case.
You need to download EXSLT.NET library [1] and run transformation using
it. Alternatively you can download nxslt.exe command line utility [2]
and test your transformation with it.
Here is the stylesheet:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:set="http://exslt.org/sets" exclude-result-prefixes="set">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<client_recs>
<xsl:for-each
select="set:distinct(atl_loads/atl_load/client_key)">
<client_key>
<xsl:value-of select="."/>
</client_key>
</xsl:for-each>
</client_recs>
</xsl:template>
</xsl:stylesheet>
[1] http://workspaces.gotdotnet.com/exslt
[2] http://www.tkachenko.com/dotnet/nxslt.html
--
Oleg Tkachenko [MVP, XmlInsider]
http://blog.tkachenko.com
1. When I try to debug the exslt extension set:distinct in XML Spy, spy
dies with an unexpected element in the set.distinct.function.xsl template
provided. There seems to be something odd about the syntax of one of the
exslt stylesheets that SPY is barking about.
2. I can get the xslt to run if I set the XSLT engine in XML Spy to MSXML
4.
3. I coded the XSLT using .NET 1.1 and having an issue with resolving the
various source documents used by EXSLT.
I am currently receiving a System.Xml.Xsl.XsltException: Cannot find the
script or external object that imp
lements prefix 'set'.
I'll have to pick this up again a couple of days.
LarryR
"LarryR" <m...@somewhere.com> wrote in message
news:OeCvpfa5...@TK2MSFTNGP09.phx.gbl...
--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com
"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:e2dN5gc5...@TK2MSFTNGP12.phx.gbl...
"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:e2dN5gc5...@TK2MSFTNGP12.phx.gbl...
For more information about the performance improvements in EXSLT.Net Release
1 read the section named "Improving Performance with Smarter Algorithms" in
this MSDN article:
"EXSLT Meets XPath"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexxml/html/xml11172003.asp
Cheers,
Dimitre Novatchev [XML MVP],
FXSL developer, XML Insider,
http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html