我想在条件上分配变量值,如下所示:
<xsl:variable name="publicationDoc"
select="document(@ID)/tcm:Component/tcm:Data
/tcm:Content/em:PublicationData" />
<xsl:variable name="CountryCompId"
select="substring-after(
$publicationDoc/em:Country/@xlink:href,
'-')" />
<xsl:variable name="countryIdLocal">
tcm:<xsl:value-of select="$publicationDoc/em:PubID"
/>-<xsl:value-of
select="substring-after($publicationDoc
/em:Country/@xlink:href,'-')" />
</xsl:variable>
<xsl:variable name="countryId">
tcm:<xsl:value-of select="substring-before(
substring-after($publication,'-'),'-')"
/>-<xsl:value-of select="substring-after(
$publicationDoc/em:Country/@xlink:href,'-')" />
</xsl:variable>
<xsl:variable name="countryLocal">
<xsl:choose>
<xsl:when test="$CountryCompId != '' ">
<xsl:value-of select="document(
$countryIdLocal)/tcm:Component/tcm:Data
/tcm:Content/em:Country" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="''" />
</xsl:otherwise>
</xsl:choose>
</xsl:choose>
</xsl:variable>
<xsl:variable name="country">
<xsl:choose>
<xsl:when test="$CountryCompId !='' ">
<xsl:value-of select="document($countryId)
/tcm:Component/tcm:Data/tcm:Content/em:Country" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="''" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
//上面我根据条件 分配值,但是当我尝试转换时它会给出以下错误&#34; 在路径表达式中使用结果树片段,首先使用msxsl:node-set()函数将其转换为节点集&#34;
似乎将文档类型值分配给变量不起作用。 (<xsl:value-of select="document($countryId)/tcm:Component/tcm:Data/tcm:Content/em:Country" />
)
有什么建议吗?