473,796 Members | 2,607 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[xsl] speed up tripple-muench


Hello,

I have a Real-World-XSLT-Problem.(tm)

That is: A XML-Document of about 75.000 elements contains
<person>-elements at various depths of the tree. Each person consists of
a <name>, <vorname> and <titel>. There are about 8000 persons in this tree.
A lot of them exist more than once. (That means that there are
person-Elements with the same content.)

The tree consists of some dozen subtrees wich are identified by
one special element at the root of the subtree. The name of this element
varies between different subtrees.

I need an alphabetically sorted list of persons. In this list I have to
use the first occurrance of a person because they are used in a
FOP-generated PDF as an anchor for a page-number. The <titel>-element
does not matter in this list.

I appy the Muench-Method three times. The problem which arisis is both
memory-usage and cpu-time. My P4-2.6 takes 10 minutes and 1.4 GB RAM.
Both is a "little bit" too much. All other transformations are done in a
fraction of seconds.

I am using libxsl 1.1.5.

Here is my xslt-template (sorry for the long lines):

#v+
<?xml version="1.0" encoding="iso-8859-1"?>

<!-- allgemeine Namespaces für alle template.fo-Dateien -->
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"

xmlns:foberon=" http://rnvs.informatik .tu-chemnitz.de/foberon"

xmlns:date="htt p://exslt.org/dates-and-times"
xmlns:str="http ://exslt.org/strings"
xmlns:dynamic=" http://exslt.org/dynamic"
xmlns:exsl="htt p://exslt.org/common"
xmlns:func="htt p://exslt.org/functions"

xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:fox="http ://xml.apache.org/fop/extensions"

exclude-result-prefixes="xsl foberon date str dynamic exsl">

<xsl:output method="xml" indent="yes"/>

<!-- get the identifier for the subtree recursively towards the root -->
<func:functio n name="foberon:g roupid">
<xsl:param name="node"/>
<xsl:variable name="res">
<xsl:choose>
<xsl:when test="$node/foberon:meta/foberon:struktu rnummer">
<xsl:value-of select="$node/foberon:meta/foberon:struktu rnummer"/>
</xsl:when>
<xsl:when test="$node/foberon:meta/foberon:nummer" >
<xsl:value-of select="$node/foberon:meta/foberon:nummer"/>
</xsl:when>
<xsl:when test="$node/foberon:meta/foberon:jahr">
<xsl:value-of select="$node/foberon:meta/foberon:jahr"/>
</xsl:when>
<xsl:otherwis e>
<xsl:value-of select="foberon :groupid($node/..)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<func:result select="$res"/>
</func:function>

<xsl:key name="kDistinct Name" match="foberon: person" use="foberon:na me"/>
<xsl:key name="kDistinct NameAndVorname" match="foberon: person" use="concat(fob eron:name,'||', foberon:vorname )"/>
<xsl:key name="kDistinct NameAndVornameA ndSNR" match="foberon: person" use="concat(fob eron:name,'||', foberon:vorname ,'||',foberon:g roupid(.))"/>

<xsl:template name="foberon:p ersonenverzeich nis">
<fo:block xsl:use-attribute-sets="profstart ">Personenverze ichnis</fo:block>
<xsl:for-each select="//foberon:person[generate-id() = generate-id(key('kDistin ctName', foberon:name))]">
<!-- sort by name -->
<xsl:sort select="foberon :name"/>
<xsl:variable name="name" select="foberon :name"/>
<!-- find all different Name-Vorname-Pairs -->
<xsl:for-each select="//foberon:person[generate-id() = generate-id(key('kDistin ctNameAndVornam e',concat($name ,'||',foberon:v orname)))]">
<!-- sort by vorname -->
<xsl:sort select="foberon :vorname"/>
<xsl:variable name="vorname" select="foberon :vorname"/>
<fo:block>
<xsl:value-of select="foberon :name"/>, <xsl:value-of select="substri ng(foberon:vorn ame,0,2)"/><xsl:text>. </xsl:text>
<!-- find first occurance of name-vorname in a subtree -->
<xsl:for-each select="//foberon:person[generate-id() = generate-id(key('kDistin ctNameAndVornam eAndSNR', concat($name,'| |',$vorname,'|| ',foberon:group id(.))))]">
<fo:basic-link internal-destination="{g enerate-id(.)}">
<xsl:choose>
<xsl:when test="not(posit ion()=last())">
<fo:page-number-citation ref-id="{generate-id(.)}"/><xsl:text>, </xsl:text>
</xsl:when>
<xsl:otherwis e>
<fo:page-number-citation ref-id="{generate-id(.)}"/><xsl:text>. </xsl:text>
</xsl:otherwise>
</xsl:choose>
</fo:basic-link>
</xsl:for-each>
</fo:block>
</xsl:for-each>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>
#v-

I tried the following:

1) Instead of using three times //foberon:person I create a variable
$persons=//foberon:person and applyed the for-each-loops on this
variable (for-each select=$persons[....]) -> no success

2) Not to use a variable in function groupid but writing:
<func:result><x sl:choose>...</xsl:choose></func:result> -> no success

There seems to be a memory-leak in libxslt.

Can you give me a hint or idea how to improve the performance of this
xslt?

Thank you in advance.
Chris
--
Chris Huebsch www.hübsch-gemacht.de | TU Chemmnitz, Informatik, RNVS
GPG-Encrypted mail welcome! ID:7F2B4DBA | Str. d. Nationen 62, B204
Chemnitzer Linux-Tage 2005, 5.-6.März | D-09107 Chemnitz
http://www.tu-chemnitz.de/linux/tag/ | +49 371 531-1377, Fax -1803
Jul 20 '05 #1
0 1587

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

Similar topics

3
1779
by: RogerTBrick | last post by:
Cheers for the help last time guys. Again this is probably dead simple but try as I might, I just can't work it out. THe XML file I am being give contains some code value that need to be exchanged for text in the final output (to HTML as it happens). <root> <thingy code="2"/> <root> My first solution (the one I thought would be easiest) was you use two
8
5279
by: Markus Wildgruber | last post by:
Hi! We want to use XSL-FO in the reporting of our application. Before making the decision we have some questions on that topic: Does anyone have experience with XSL-FO in the .NET environment? Is that a useful technique for professional reporting? Is it technically mature? Does anyone know of a control (WinForms/WebForms) that we can use to show the formatted XSL-FO data?
1
1295
by: Noman | last post by:
i am developing a system using VB 6 and Ms Access 2000. overall the system is working fine but at few instances the program get stuck for few minutes like 2 to 3 minutes i.e it is very slow. the accasions where it gets slow exists when number of records exceeeds 10,000 records. Main Ocasion where program gets slow in a table there is a field number,lenofnum,sale1,sale2
1
8138
by: Peter | last post by:
Has anyone made a simple tripple des encryption function? I'm looking for a function to pass a string into with a password and generate an encrypted output. That's it. IE. Public Function EncryptMe (StringtoEncrypt, Password)as string End Function Public Function DecryptMe (StringtoDecrypt, Password)as string
1
2512
by: peter.fredrikson | last post by:
Hi, I have a web server application (C#) which I would like to speed up a little. I would appriciate a discussion of design principles for a specific optimization scenario described below. My web server process every request by building a XML structure containing both application data, data from the database (or another system), and presentation data, describing how to present the application data in the GUI. Then the web server...
1
1895
by: ml41782 | last post by:
I have a personal web server that imports from my weather station. The data is already in XML format. I created my xsl and it displays the data on the web page very nicely. I have been unsuccessful on trying to link from the discriptor field. I'm trying to link to a more detailled report on each item to show a graph of the past 12 hours. I have the part done and this part. I need help breaking my roadblock to link the discriptor to the...
8
6015
by: DarthLuch | last post by:
Would like to get feedback on a process we do, as well as suggested alternatives. We produce a software for the airline biz... One of the features is take take aircraft OEM provided SGML/XML data, mix it with data from our own application, and show a PDF print of it. We save our own data as xml, merge it with the OEM xml data, and use a stylesheet to control how we want it to look. We use Apache FOP to turn it into a PDF. ...
3
10497
by: Dave Cullen | last post by:
Hello C I have a project that requires a calculated "key" to be used in a security access application. The customer supplies a secret 8 byte number that gets combined with the serial number of the access card to provide a unique access key for that card. They've specified that the encryption method (called "diversification") is something called Tripple DES. I'm not a crypto weenie, just a software guy. My research on this has led me...
1
2749
by: Farooq Ahmad | last post by:
Dear All, I am in problem of implimenting Tripple DES (3DES) (ECB Mode) Encyption in vaisal basic 6.0. Can Anybody help me in this regard. Any Source Code OR DLL libarary. Thank In Advance.
8
1814
by: mijn naam | last post by:
Trying to find info about this, but searching for '///' or for 'tripple slash' doesn't provide relevant answers. Can anyone please point me in the right direction? A simple script, called debug.php, shows some variables. I can call this script using http://server/debug/show.php or using http://server/debug/show Also I can add more to the URL, and the script is still called. So far so good.
0
9531
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10459
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10187
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7553
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6795
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5446
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.