This solution only works if the XPath expressions are all valid XSLT
patterns. It would certainly make the problem easier if this can be
guaranteed.
Michael Kay
http://www.saxonica.com/
Either run file2.xml through
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:axsl="http://www.w3.org/1999/XSL/Transform/alias">
<xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/>
<xsl:template match="mapping">
<axsl:stylesheet version="1.0">
<xsl:for-each select="replace">
<axsl:template match="{xpath}">
<axsl:attribute name="{{name()}}">
<xsl:value-of select="with"/>
</axsl:attribute>
</axsl:template>
</xsl:for-each>
<axsl:template match="@* | node()">
<axsl:copy>
<axsl:apply-templates select="@* | node()"/>
</axsl:copy>
</axsl:template>
</axsl:stylesheet>
</xsl:template>
</xsl:stylesheet>
and then process file1.xml with the generated stylesheet. Or
use Mike's solution that used the extension function.
Cheers,
Jarno
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--