This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Merging two files
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] Merging two files
- From: Oliver Becker <obecker at informatik dot hu-berlin dot de>
- Date: Mon, 12 Feb 2001 17:35:59 +0100 (MET)
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Matt,
> However, I am unable to get the correct <NodeID>s from the secondary
> file that don't exist in the primary file. Currently, I am using something
> like the following:
>
> <xsl:for-each select = "$YESTERDAY_PRODUCT">
> <xsl:if test = "$YESTERDAY_PRODUCT//NodeID[not
> ($YESTERDAY_PRODUCT//NodeID=NodeID)]">
> <Product>
> <xsl:attribute name="Action">D</xsl:attribute>
>
> <xsl:copy-of select="*"/>
> </Product>
> </xsl:if>
> </xsl:for-each>
>
> where $YESTERDAY_PRODUCT is a path in the secondary file. This
> currently gives me multiple copies of everything in the second file.
This expression
$YESTERDAY_PRODUCT//NodeID[not($YESTERDAY_PRODUCT//NodeID=NodeID)]
selects all NodeID nodes from your file, for which another NodeID node exists,
which in turn has not the same string value. I guess this is true for every
NodeID node.
You want
not($YESTERDAY_PRODUCT//NodeID[$YESTERDAY_PRODUCT//NodeID=NodeID])
i.e. if you don't find another node with the same string value then this
node seems to be interesting for you.
BTW, I'm a little bit confused about your xsl:for-each construction.
I believe you should access . or any other relative location path in
your xsl:if, not $YESTERDAY_PRODUCT again.
Cheers,
Oliver
/-------------------------------------------------------------------\
| ob|do Dipl.Inf. Oliver Becker |
| --+-- E-Mail: obecker@informatik.hu-berlin.de |
| op|qo WWW: http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list