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

Re: Merging two files

Subject: Re: Merging two files
From: mjyoungblut@xxxxxxx
Date: Mon, 12 Feb 2001 12:58:04 -0600
merging two files
Mr. Becker,
     I used your suggestion - changing
          $YESTERDAY_PRODUCT//NodeID[not
($YESTERDAY_PRODUCT//NodeID=NodeID)]
     to
          not($YESTERDAY_PRODUCT//NodeID
[$YESTERDAY_PRODUCT//NodeID=NodeID]).

Now my problem is that I am getting multiples of the node that exists in
the secondary file, but not in the primary file.  I am getting these
results because I am running inside a template for the first file.  Thus,
each iteration produces another node with the same id in the output.
Without having to decare a template for the second file, is there a way
that I can only get one of the results inserted into the output?

Thanks again,
     Matt Youngblut





Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx> on 02/12/2001 10:35:59 AM

Please respond to xsl-list@xxxxxxxxxxxxxxxxxxxxxx


To:   xsl-list@xxxxxxxxxxxxxxxxxxxxxx
cc:    (bcc: Matthew J. Youngblut/US-Corporate/3M/US)
Subject:  Re:  Merging two files



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@xxxxxxxxxxxxxxxxxxxxxxx             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/


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








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


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.