This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Two file problem.


Nice way to merge the 2 loops !

document('dp-f1.xml')/fa/a|
document('dp-f2.xml')/fb/a[not(@name=document('dp-f1.xml')/fa/a/@name)]

Eric

David Carlisle wrote:
> 
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0"><xsl:output method="xml" indent="yes"/>
> <xsl:template match="/">
> <xsl:for-each select="document('dp-f1.xml')/fa/a|
> document('dp-f2.xml')/fb/a[not(@name=document('dp-f1.xml')/fa/a/@name)]">
> <xsl:sort select="@name"/><a name="{@name}">
> <xsl:value-of select="sum(document('dp-f1.xml')/fa/a[@name=current()/@name]|
> document('dp-f2.xml')/fb/a[@name=current()/@name])"/>
> </a>
> </xsl:for-each>
> </xsl:template>
> </xsl:stylesheet>
> 
> saxon dp-f.xsl dp-f.xsl
> <?xml version="1.0" encoding="utf-8" ?>
> <a name="a1">4</a>
> <a name="a2">5</a>
> <a name="a3">3</a>
> <a name="a4">2</a>
> <a name="new">1</a>
> 
> David
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

-- 
------------------------------------------------------------------------
Eric van der Vlist       Dyomedea                    http://dyomedea.com
http://xmlfr.org         http://4xt.org              http://ducotede.com
------------------------------------------------------------------------


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]