6

スタイルシートを使用してマージする必要がある2つのxmlファイルがあります

<AssessmentInput>
  <ApplicationData>...</AppicationData>
  <MetricList>...</MetricList>
</AssessmentInput>

1 つは ApplicationData で、もう 1 つは MetricList です。これが私がやったことですが、本来あるべきものに近いものではありません

<?xml version="1.0" encoding="ascii"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/common" exclude-result-prefixes="xsl exslt">
    <xsl:output omit-xml-declaration="yes" method="xml" encoding="UTF-8"/>
    <xsl:param name="ApplicationData" select="/"/>
    <xsl:param name="MetricList"/>
    <xsl:template match="/">
        <xsl:apply-templates select="$ApplicationData/ApplicationData"/>
    </xsl:template>
    <xsl:template match="ApplicationData">
        <xsl:copy>
            <xsl:apply-templates select="@*"/>
            <xsl:apply-templates select="*"/>
        </xsl:copy>
    </xsl:template>
    <xsl:template match="@* | node()">
        <xsl:copy>
            <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>

私を助けてください。XSLT の経験はありません。

4

2 に答える 2

0

以下のように行を置き換える必要があります:-

<xsl:param name="ApplicationData" select="/"/>
  <xsl:param name="MetricList"/>

これは1行目の下にあります:

   <xsl:variable name="Application_Data" select="document('Application_Data.xml')/ApplicationData"/>
 <xsl:variable name="'Metric_List" select="document('Application_Data.xml')/MetricList"/>

私はこれがあなたを助けるかもしれないと思う..

于 2013-09-26T08:31:19.563 に答える