问题
I have provided the input and desired expected xml in another question at the below link: How to re-arrange xml using xslt with repeated xml nodes
Request to please let me know how to join the below 2 XSL codes in a single XSL file so that it works on my input xml.
Code for 'INFONAMEADDRESSMANUFACTPLANT' Node:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*" />
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="INFONAMEADDRESSMANUFACTPLANT" />
<xsl:template match="INFONOTE">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<INFONAMEADDRESSMANUFACTPLANT>
<VARIABLELABEL>IFM</VARIABLELABEL>
<xsl:for-each select="INFONAMEADDRESSMANUFACTPLANT">
<xsl:copy-of select="SERIALNO1" />
<xsl:copy-of select="SPONSOR_NAME" />
<xsl:copy-of select="SPONSOR_ADDRESS1" />
<xsl:copy-of select="SPONSOR_ADDRESS2" />
<xsl:copy-of select="MANUFACTURERIMPORTERCODE" />
</xsl:for-each>
</INFONAMEADDRESSMANUFACTPLANT>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Code for 'INFOPERSONFILLNOTE' node:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@*|node()">
<xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
</xsl:template>
<xsl:template match="INFOPERSONFILLNOTE">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="VARIABLELABEL"/>
<xsl:for-each select="SERIALNO1|CLASSPERSONFILLNOTE">
<xsl:sort select="number(translate(VARIABLELABEL, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', ''))" order="ascending"/>
<xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
</xsl:for-each>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Please help.
来源:https://stackoverflow.com/questions/60144910/how-to-join-2-xsl-codes-in-a-single-xsl-file