0

我有两个xml,如下所示以及它的xsl定义,现在请告知两个xml中现在有一个标签,因为它存在于Second.xml中但不存在于First.xml中我想配置xsl定义,例如它应该适用于这两种情况 现在它只适用于 Second.xml 我希望应该以这样的方式配置 xsl 定义,它应该适用于两种情况,因为有时在 xml 中我们没有得到值的标签有时。请指教

***************
    First.xml
****************
<productClassificationIdentifier>
            <ClassificationId>1022</ClassificationId>
            <ClassificationName>AAABBB</ClassificationName>
            <Reference>FFF</Reference>
    </productClassificationIdentifier>


***************
    Second.xml
****************
<productClassificationIdentifier>
            <ClassificationId>1044</ClassificationId>
            <ClassificationName>CCCDDD</ClassificationName>
            <Reference>JJJ</Reference>
                <ClassificationIdScheme>FirstClassification</ClassificationIdScheme>
        </productClassificationIdentifier>


***************
    XSL Defination
****************

        <xsl:param name="abvIdVar"/>
        <xsl:for-each select="$abvIdVar">
            <xsl:choose>
                <xsl:when test="./ClassificationIdScheme = 'FirstClassification'">
                    <xsl:value-of select="./ClassificationId"/>
                </xsl:when>
            </xsl:choose>
        </xsl:for-each>

请各位大侠指教..!!

嗨伙计,

我已经通过

 <xsl:otherwise>
xsl:value-of select="./ClassificationId"/>                               </xsl:otherwise>
4

1 回答 1

0

如果您想在不存在“ClassificationIdScheme”元素的第一个 XML 条件下运行此条件,请使用以下条件更改您的条件:

  <xsl:when test="./ClassificationIdScheme = 'FirstClassification' or not(./ClassificationIdScheme)">
    <xsl:value-of select="./ClassificationId"/>
  </xsl:when>
于 2013-06-07T06:49:31.777 回答