0
ステートメントxsl:call-template
を呼び出す前に条件を実行する必要があります。私は、値1または値2にNullまたは空の値がある場合、文字列を分割した後で、レコード全体とその中の要素を印刷しないでください。ここでXSLTの分割シナリオのNullまたはWhiteSpaceの考慮を制限するためのxsl:call-templateの条件
は、私は必要なものだけ短い例です:
Value1 : Name1;;Name3
Value2 : Sam;Tsn;Doug
予想される出力:だから、ここでそれが値1でブランク値を持っていたので、第二のタイプと値が印刷されませんでした
<Profile>
<Type>Name1</Type>
<Value>Sam</Value>
</Profile>
<Profile>
<Type>Name3</Type>
<Value>Doug</Value>
</Profile>
また、Value2に空白の値があり、Value1に値がある場合は、その値を印刷しないように制限する必要があります。私が試してみました何
:何が起こっているのか 問題は、それが、私たちは私がのBizTalkマップで、このXSLTコードを使用しています
あそこ<xsl:template name="WritePropertyNodeTemplateName">
<xsl:param name="Name" />
<xsl:param name="Type" />
<xsl:if test="$Name != '' and $Type != ''"> // Had put condition here but didnt work
<xsl:call-template name="StringSplitName">
<xsl:with-param name="val1" select="$Name" />
<xsl:with-param name="val2" select="$Type" />
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="StringSplitName">
<xsl:param name="val1" />
<xsl:param name="val2" />
<xsl:choose>
<xsl:when test="contains($val1, ';')">
<xsl:if test="$val2 != '' and $val1 != ''">
<xsl:value-of select="'1st'" />
<ns1:OtherType xmlns:ns1="http://schemas.datacontract.org/2004/07/GEP.Cumulus.WebInterfaces.BusinessEntities">
<ns1:Name xmlns:ns1="http://schemas.datacontract.org/2004/07/GEP.Cumulus.WebInterfaces.BusinessEntities">
<xsl:value-of select="substring-before($val1, ';')" />
</ns1:Name>
<ns1:Type xmlns:ns1="http://schemas.datacontract.org/2004/07/GEP.Cumulus.WebInterfaces.BusinessEntities">
<xsl:value-of select="substring-before($val2, ';')" />
</ns1:Type>
</ns1:OtherType>
<xsl:call-template name="StringSplitName">
//Tried to put condition here also but didnt work
<xsl:with-param name="val1" select="substring-after($val1, ';')" />
<xsl:with-param name="val2" select="substring-after($val2, ';')" />
</xsl:call-template>
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:template>
チェックを行うことができないので、値が含まれて常にあります。
あなたの答えをありがとうが、このソリューションは、空白またはNull条件でのみ動作します。値2の値が 'Tsn'であることを示し、値Tsnの場合は印刷されません。 – Learner
@Learnerあなたの質問にこのような状態は言及されていないので、当然私はそれに対処しませんでした。とにかく、既存のものに**任意の**条件を追加するのは非常に簡単です。問題を解決できない場合は、新しい質問を投稿してください。 –
あなたの助けをありがとう – Learner