Hi,
Tempore 10:34:27, die 07/06/2005 AD, hinc in
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com scripsit Lakshmi narayana
<lchintala(_at_)osi-tech(_dot_)com>:
6) Can any one send me the xsl code for this scenario.
consider that the scond file is named 'second.xml' and the stylesheet is
processed on the first file.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" method="xml"/>
<xsl:key name="newName" match="destination"
use="concat(local-name(../..),../source/@name)"/>
<xsl:template match="node()">
<xsl:copy>
<xsl:apply-templates select="@*">
<xsl:with-param name="Type" select="@Type"/>
</xsl:apply-templates>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*">
<xsl:param name="Type"/>
<xsl:variable name="name" select="local-name()"/>
<xsl:variable name="newname">
<xsl:for-each select="document('second.xml')">
<xsl:value-of
select="key('newName',concat($Type,$name))/@name"/>
</xsl:for-each>
</xsl:variable>
<xsl:attribute name="{$newname}"><xsl:value-of select="."/></xsl:attribute>
</xsl:template>
<xsl:template match="@Type"><xsl:copy/></xsl:template>
</xsl:stylesheet>
will produce:
<A1 A-Element-Name="A1" A-sequence="1" A-Description="optional"
Type="AGroup">
<B1 B-Element-Name="B1" B-sequence="101" B-order="first" Type="BGroup"/>
<B2>
<C1 C-Element-Name="C1" C-sequence="201" C-order="Sec"
Type="CGroup"/>
<C2 C-Element-Name="C2" C-sequence="202" C-order="Sec"
Type="CGroup">
<C3/>
<D1 D-Element-Name="D1" D-Min="1" D-Max="1" D-Reference="Trr"
D-Predicate="" Type="DGroup">
<C2 C-Element-Name="C2" C-sequence="202" C-order="Sec"
Type="CGroup"/>
</D1>
</C2>
</B2>
</A1>
regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Spread the wiki (http://www.wikipedia.org)
--~------------------------------------------------------------------
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>
--~--