473,320 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Attempt to identify unique keys using .NET xsltransform hangs, but works fine in MSXML 4.0

The following XSLT works fine using MSXML 4.0 (e.g I receive a result in
about 20 seconds), but effectively hangs in both .NET 1.0 sp2 with the XML
hot fix and NET 1.1. My source XML file is large at over 46,000
<atl_client> nodes

<?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.

Nov 12 '05 #1
9 1768
It's likely that the problem is in generate-id(). It is very slow in v.1.
It will be much better in sp.1 of .NET 1.1, but not as good as MSXML 4.
MSXML doesn't call any generate-id() in this case but does node comparison.
--
Sergey
-------
This posting is provided "AS IS" with no warranties, and confers no rights.
"LarryR" <ru********@cox.net> wrote in message
news:SIGNb.2673$dd6.1001@lakeread02...
The following XSLT works fine using MSXML 4.0 (e.g I receive a result in
about 20 seconds), but effectively hangs in both .NET 1.0 sp2 with the XML
hot fix and NET 1.1. My source XML file is large at over 46,000
<atl_client> nodes

<?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.


Nov 12 '05 #2
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.

Thank you for your response, Sergey

LarryR
"Sergey Dubinets" <sd**@online.microsoft.com> wrote in message
news:uX**************@TK2MSFTNGP10.phx.gbl...
It's likely that the problem is in generate-id(). It is very slow in v.1.
It will be much better in sp.1 of .NET 1.1, but not as good as MSXML 4.
MSXML doesn't call any generate-id() in this case but does node comparison. --
Sergey
-------
This posting is provided "AS IS" with no warranties, and confers no rights.

"LarryR" <ru********@cox.net> wrote in message
news:SIGNb.2673$dd6.1001@lakeread02...
The following XSLT works fine using MSXML 4.0 (e.g I receive a result in
about 20 seconds), but effectively hangs in both .NET 1.0 sp2 with the XML hot fix and NET 1.1. My source XML file is large at over 46,000
<atl_client> nodes

<?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.



Nov 12 '05 #3
LarryR wrote:
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
Nov 12 '05 #4
I have been impressed with the extensions offered by exslt.org. I'll give
it a try and post back.
LarryR
"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:Ob**************@TK2MSFTNGP11.phx.gbl...
LarryR wrote:
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

Nov 12 '05 #5
Here is the latest results:

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" <me@somewhere.com> wrote in message
news:Oe**************@TK2MSFTNGP09.phx.gbl...
I have been impressed with the extensions offered by exslt.org. I'll give
it a try and post back.
LarryR
"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:Ob**************@TK2MSFTNGP11.phx.gbl...
LarryR wrote:
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


Nov 12 '05 #6
LarryR, it's extension element, not supported by MSXML, XML Spy's engine
or .NET. You have to use EXSLT.NET library or nxslt.exe utility (which
includes EXSLT.NET code). The simplest way is to get nxslt.exe and
register it in XML Spy as external transformer:
d:\temp\nxslt.exe %1 %3 -o %2

--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com
Nov 12 '05 #7
Geesh, it's wonderful to learn something new everyday. I'll try it and let
you know.

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:e2**************@TK2MSFTNGP12.phx.gbl...
LarryR, it's extension element, not supported by MSXML, XML Spy's engine
or .NET. You have to use EXSLT.NET library or nxslt.exe utility (which
includes EXSLT.NET code). The simplest way is to get nxslt.exe and
register it in XML Spy as external transformer:
d:\temp\nxslt.exe %1 %3 -o %2

--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com

Nov 12 '05 #8
Great results. 695 unique keys generated from about 46000 records in less
than 2 seconds. Fantastic. Thank you for the information.

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:e2**************@TK2MSFTNGP12.phx.gbl...
LarryR, it's extension element, not supported by MSXML, XML Spy's engine
or .NET. You have to use EXSLT.NET library or nxslt.exe utility (which
includes EXSLT.NET code). The simplest way is to get nxslt.exe and
register it in XML Spy as external transformer:
d:\temp\nxslt.exe %1 %3 -o %2

--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com

Nov 12 '05 #9

"LarryR" <me@somewhere.com> wrote in message
news:Oo**************@TK2MSFTNGP09.phx.gbl...
Great results. 695 unique keys generated from about 46000 records in less
than 2 seconds. Fantastic. Thank you for the information.


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/de...ml11172003.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
Nov 12 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Rolf Kemper | last post by:
Dear Experts, I got stuck with the following problem and need your help. What I wnat to do is to get a set of distinct nodes. Before the distinct I have selected the multiple occourences...
8
by: DraguVaso | last post by:
Hi, I want my application do different actions depending on the exception it gets. For exemple: I have an SQL-table with a unique index. In case I try to Insert a record that's alreaddy in it I...
19
by: Mark Miller | last post by:
QUESTION: Does anyone know how I can use v2.6 of the MSXML parser with .NET? BACKGROUND: I "Web to Print" process that allows our clients (newspapers) to export their data and pass it thru a...
6
by: Alfred Taylor | last post by:
I'm having performance/memory problems using .NET's XslTransform class so I thought I'd give the MSXML object's a whirl. The question I haven't been able to find in these groups is can I use C#...
2
by: KJS | last post by:
Hello, I'm receiving: 'System.Xml.Xsl.XsltException: Missing mandatory attribute 'version' After I try and run my transformation. I spent a good few days coming up with the appropriate (I think)...
1
by: Peter Row | last post by:
Hi, BACKGROUND: I have a VB.NET DLL that uses HttpModules, HttpHandlers etc... which has been ported from a VB6 webclass application. I am developing on WinXP Pro SP1, P4 2Ghz, 512MB Ram I...
4
by: Sean Hoffman | last post by:
Framework 1.1 SP1. Page.xml is about 1.5mg. m_oXSLTransform.Transform takes about 2 minutes. When Page.xml is trimmed down to a smaller doc, it takes about 2 seconds. Same code ran in about...
5
by: Jeroen | last post by:
We're using MSXML to transform the XML document we have to an XHTML file using an XSLT. Now the problem is that the dotnet implementation we made does something subtly different from the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.