|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Node comparison
Second attempt using <xsl:copy> instead of <xsl:element>. Using
<xsl:copy> seems a little more straightforward and simplifies
the template.
<xsl:template match="Parent_2">
<xsl:copy>
<xsl:for-each select="*">
<xsl:variable name="destName" select="name()"/>
<xsl:copy>
<xsl:value-of select="/test1/Parent_1/*[name()=$destName]/text()"/>
</xsl:copy>
</xsl:for-each>
</xsl:copy>
</xsl:template>
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Don
> Stinchfield
> Sent: Sunday, April 15, 2001 11:03 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: Node comparison
>
>
> Kevin,
>
> As a first attempt I used the <xsl:element> tag to solve the problem.
> I queried for the correct value by comparing element names. This is
> based on the assumption that for tag names you meant "<Value 1>" to be
> "<Value_1>" and not "<Value qualifier="1">.
>
> <xsl:template match="Parent_2">
> <xsl:copy>
> <xsl:for-each select="*">
> <xsl:variable name="destName" select="name()"/>
> <xsl:element name="{$destName}">
> <xsl:value-of
> select="/test1/Parent_1/*[name()=$destName]/text()"/>
> </xsl:element>
> </xsl:for-each>
> </xsl:copy>
> </xsl:template>
>
> Hope this is what you were looking for.
>
> Regards,
> Don
>
> > Kevin_Gutch@xxxxxxxxxxx
> > Sent: Saturday, April 14, 2001 7:12 PM
> >
> > Having two different XML's joined on an entity reference I need to
> > compare values underneath two different parent nodes without
> having to use
> > a $Position Variable. The reason being is that I may not have a
> one to one
> > relationship. So
> > with an example below I would like to use my XSLT to base the values of
> > Parent 2 on the like values in Parent 1.
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <Parent 1>
> > <Value 1>1</Value 1>
> > <Value 2>0</Value 2>
> > <Value 3>1</Value 3>
> > <Value 4>0</Value 4>
> > </Parent 1>
> > <Parent 2>
> > <Value 1> </Value 1>
> > <Value 2> </Value 2>
> > <Value 2> </Value 2>
> > <Value 3> </Value 3>
> > <Value 4> </Value 4>
> > </Parent 2>
> >
> > I would like the following results:
> >
> > <Parent 1>
> > <Value 1>1</Value 1>
> > <Value 2>0</Value 2>
> > <Value 3>1</Value 3>
> > <Value 4>0</Value 4>
> > </Parent 1>
> > <Parent 2>
> > <Value 1>1</Value 1>
> > <Value 2> 0</Value 2>
> > <Value 2> 0</Value 2>
> > <Value 3> 1</Value 3>
> > <Value 4> 0</Value 4>
> > </Parent 2>
> >
> > Any ideas on how to do this?
> >
> >
> >
> > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
> >
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








