[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Processing Efficiently

Subject: RE: Processing Efficiently
From: <tomas.vanek@xxxxxxxxxxxxx>
Date: Wed, 8 Jun 2005 11:05:42 +0200
xml to xls
using keys could help to speed up the transformation (here is just the
idea):

...
	<xsl:key name="summaryInvoice"
use="document('summary.xml')//xls/R" match="C[@c='I']"/>

...
	<xsl:template match="xlsRow">
		<xsl:variable name="current_invoice"
select="xlsColumn[@column='Invoice_#']"/>
		<xsl:variable name="current_balance"
select="key('summaryInvoice', $current_invoice)/C[@c='B']"/>
		<xsl:variable name="diff_balance"
select="$current_balance - xlsColumn[@column='Balance']"/>
...

tomi


-----Original Message-----
From: Karl Stubsjoen [mailto:kstubs@xxxxxxxxx]
Sent: Wednesday, June 08, 2005 10:08 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Processing Efficiently

Hello,
I would like to optimize the following:

Where $s is a 5MB document and the source document is app 2-5MB.
The goal:  copy everything in the source that exists in $s.
Catch:  need to know the value of the balance in $s.

$s looks like:
<xls>
<R row="2">
  <C c="I">2AA9379</C><!-- match value "invoice" -->
  <C c="B">-127.5</C><!-- this is the balance --> </R> ...
</xls>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" encoding="utf-8"/>

<xsl:variable name="s"
select="document('summarydata/summaryreduced.xml')//xls/R"/>

<xsl:template match="/">
<result>
<xsl:apply-templates
select="xls/xlsRow[xlsColumn[@column='Invoice_#']=$s/C[@c='I'] |
xlsColumn[@column='Balance'][not(.= $s/C[@c='B'])]]"/> </result>
</xsl:template>

<xsl:template match="xlsRow">
<xsl:variable name="current_invoice"
select="xlsColumn[@column='Invoice_#']"/>
<xsl:variable name="current_balance"
select="$s[C[@c='I']=$current_invoice]/C[@c'B']"/>
<xsl:variable name="diff_balance" select="$current_balance -
xlsColumn[@column='Balance']"/> <xsl:copy> <xsl:apply-templates
select="@*"/> <xsl:attribute name="current_balance"><xsl:value-of
select="$current_balance"/></xsl:attribute>
<xsl:attribute name="diff_balance"><xsl:value-of
select="$diff_balance"/></xsl:attribute>
  <xsl:apply-templates select="xlsColumn"/> </xsl:copy> </xsl:template>

<xsl:template match="@*">
<xsl:copy>
  <xsl:apply-templates select="@*"/>
</xsl:copy>
</xsl:template>

<xsl:template match="xlsColumn">
<xsl:copy-of select="."/>
</xsl:template>

</xsl:stylesheet>



This message is for the designated recipient only and may contain privileged,
proprietary, or otherwise private information.  If you have received it in
error, please notify the sender immediately and delete the original.  Any
other use of the email by you is prohibited.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.