[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: RE: [xsl] copy nodes() of other XML file
From: "Jimenez, Luis" <Luis.Jimenez@xxxxxxxxx>
Date: Sat, 11 Dec 2010 18:15:56 -0500

Hi Ken,

Thank you very much.

with your changes work as needed.

Thanks,

Luis Fdo.


-----Mensaje original-----
De: G. Ken Holman [mailto:gkholman@xxxxxxxxxxxxxxxxxxxx]
Enviado el: Sabado, 11 de Diciembre de 2010 06:07 p.m.
Para: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Asunto: Re: [xsl] copy nodes() of other XML file

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@xxxxxxxxxxxxxxxxxxxx
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


Current Thread
Keywords