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[(_at_)column='Invoice_#']=$s/C[(_at_)c='I'] |
xlsColumn[(_at_)column='Balance'][not(.= $s/C[(_at_)c='B'])]]"/>
</result>
</xsl:template>
<xsl:template match="xlsRow">
<xsl:variable name="current_invoice"
select="xlsColumn[(_at_)column='Invoice_#']"/>
<xsl:variable name="current_balance"
select="$s[C[(_at_)c='I']=$current_invoice]/C[(_at_)c'B']"/>
<xsl:variable name="diff_balance" select="$current_balance -
xlsColumn[(_at_)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>
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--