without seeing what your source xml looks like, or what output format
you want to generate it's fairly impossible to give any specific advice,
but a few observations.
<xsl:variable name="variation">
...
this means that $variation will hole a result tree fragment, which means
that
<xsl:for-each select="$variation">
will generate an error on a conformant XSLT 1.0 processor, if you are
using XSLT 2, best to say so, as any answeres are likely to be rather
different in that case. For XSLT1 you'd need a node-set extension
function.
In general it's rather hard to define "difference" (see a long thread on
exactly that subject lastweek)
for example if your two fragments are
<a>
<b/>
<c/>
<d/>
</a>
and
<a>
<x/>
<b/>
<c/>
<d/>
</a>
What do you want to mark as the "difference", is it that an element x
was added (this does actually correspond to the edit I made to generate
the text above) or do you want to mark that the frst child changed from
b to x, the second from c to b, the third from d to c, and a new fourth
child, d added.
Depending on which of those two answers you want, the code is likely to
be radically different.
<xsl:if test=". != $compare-node">
<xsl:copy-of select="."/>
<xsl:attribute name="different">current</xsl:attribute>
</xsl:if>
This will always generate an error if teh test is true.
The copy-of . copies an element node, and then xsl:attribute tries to
add an attribute to the currently open node, ie the parent of teh node
just copied, and you can not add attributes to an element once a child
has been added.
David
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
--~------------------------------------------------------------------
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>
--~--