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

RE: Conditional Merge - what am I missing?

Subject: RE: Conditional Merge - what am I missing?
From: Nate Austin <naustin@xxxxxxxxxx>
Date: Tue, 8 Jan 2002 09:38:46 -0600
stub xsl

-----Original Message-----
Jeni -

> First, when you come across a particular element in your stub, you are
> copying *all* the elements in the data with the same name. So when
> your stub contains two RelatedParty elements and your data contains
> two RelatedParty elements, you get both RelatedParty elements from the
> data appearing for each RelatedParty elements in the stub (end up with
> four of them).

> I'm not sure what you want to do about that - it depends on what
> semantics you have for the stub.

Sorry, I forgot to mention that the stub will not repeat any element at a
particular level.  (so, for example, <RelatedParty> will never be repeated
under <CustData>, but <FedId> can be used under both <CustData> and
<RelatedParty> )

> Second, the cause of missing information is that within your main
> template, you apply templates without a select attribute at a point
> where the current node is from the data portion of the document, not
> the stub portion of the document:

> You need to have a variable to keep track of the current node at that
> point, and to apply templates to its element children:

Ah.  There's the issue.  I tried it earlier with:
   <xsl:apply-templates select="./node()">
     <xsl:with-param name="context" select="current()"/>
   </xsl:apply-templates>

and some other similar methods.  For some reason I was working under the
impression that xsl:for-each only changed the current node and not the
context node.  That's what I get for starting to work on a problem at 8am
Monday morning with four hours of sleep under my belt (let's see how many
more excuses I can come up with... :).  At any rate, when I change the
xsl:for-each to look like this:
    <xsl:variable name="curr" select="."/>
    <xsl:for-each select="$context/child::*[name() = $currNodeName]">
      <xsl:copy>
        <xsl:apply-templates select="text()"/>
        <xsl:apply-templates select="$curr/node()">
          <xsl:with-param name="context" select="current()"/>
        </xsl:apply-templates>
      </xsl:copy>
    </xsl:for-each>

it of course works like a charm.  Thanks for the help, Jeni!

-Nate

 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.