|
Subject: RE: [xsl] Conditional Merge - what am I missing? From: Nate Austin <naustin@xxxxxxxxxx> Date: Tue, 8 Jan 2002 09:38:46 -0600 |
-----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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Conditional Merge - what , Jeni Tennison | Thread | [no subject], sqjfh hjfskjf |
| Re: Regular expression functions (W, Jeni Tennison | Date | [xsl] XPath 2.0, Miloslav Nic |
| Month |