xsl-list
[Top] [All Lists]

Re: [xsl] copy nodes() of other XML file

2010-12-11 17:06:52
At 2010-12-11 17:51 -0500, Jimenez, Luis wrote:
I'm trying to copy the contents of a node that is in one file to another, but must be copied into a document.

XSLT version 1.0

******
My main XML file:
...
******
My Second XML File - which should make the information:
...
******
My XSL File:
...
<xsl:template match="pd">
  <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
      <xsl:variable name="id" select="frmecc/cab/ccon"/>
      <xsl:for-each select="$doc1">
        <xsl:copy-of select="key('k1', $id)/detctacte"/>
      </xsl:for-each>
  </xsl:copy>
</xsl:template>

I think your problem is above.

******
My Desired Output:
...
Thanks to everyone for the help.

You don't say what is wrong, but when I ran your stylesheet I didn't get your desired results. It would help next time to bring focus to where you are having the problem.

In your stylesheet you are adding the remote document's information to the end of <pd>, yet in your desired result it seems you are adding the remote document's information to the end of <frmecc>. So I just changed the above to this which has the focus on the <frmecc> element:

<xsl:template match="frmecc">
  <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
      <xsl:variable name="id" select="cab/ccon"/>
      <xsl:for-each select="$doc1">
        <xsl:copy-of select="key('k1', $id)/detctacte"/>
      </xsl:for-each>
  </xsl:copy>
</xsl:template>

... and I think it produces what you are asking for. Is that all that is wrong?

I hope this helps.

. . . . . . . . . . Ken

--
Contact us for world-wide XML consulting & instructor-led training
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>