我的代碼是:我們必須從指定的路徑獲取描述。但是在Description1Name中發生重複;是否可以刪除重複?我已經找到了它,但是這不起作用。如何在xslt中的標記中複製值?
?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:template match="/">
<xsl:param name="text1" select="PFA/Description1List/Description1Name"/>
<xsl:param name="text2" select="PFA/Description2List/Description2Name"/>
<Entity_List Type="LIST_TYPE_CUSTOM_ENTITY" xmlns="https://support.bridgerinsight.lexisnexis.com/downloads/xsd/4.2/CWLEntityExport.xsd">
<xsl:for-each select="PFA/Records/Person">
<Entity>
<First_Name>
<xsl:value-of select="NameDetails/Name/NameValue/FirstName"/>
</First_Name>
<Reason_Listed>
<xsl:for-each select="Descriptions/Description" >
<xsl:variable name="check1" select="@Description1"></xsl:variable>
<xsl:variable name="check2" select="@Description2"></xsl:variable>
<!--<xsl:if test="index-of(temp, $check1)!=()">-->
<xsl:for-each select="$text1">
<xsl:if test="[email protected]ription1Id">
<xsl:value-of select="."/>
<!--</xsl:call-template>-->
<xsl:text>;</xsl:text>
<!--<xsl:variable name="temp" select="$check1"/>-->
</xsl:if>
</xsl:for-each>
<!--</xsl:if>-->
<xsl:for-each select="$text2">
<xsl:if test="[email protected] and [email protected] ">
<xsl:value-of select="."/>
<xsl:text>;</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</Reason_Listed>
</Entity>
</xsl:for-each>
</xsl:template>
的投入將是:
<Description1List>
<Description1Name Description1Id="1" RecordType="Person">Politically Exposed Person (PEP)</Description1Name>
<Description1Name Description1Id="2" RecordType="Person">Relative or Close Associate (RCA)</Description1Name>
</Description1List>
<Description2List>
<Description2Name Description2Id="1" Description1Id="1">Sanctions Lists</Description2Name>
<Description2Name Description2Id="2" Description1Id="2">Other Official Lists</Description2Name>
</Description2List>
<Records>
<Person id="196542" action="add" date="19-Jul-2017">
<Gender>Male</Gender>
<ActiveStatus>Active</ActiveStatus>
<Deceased>No</Deceased>
<NameDetails>
<Name NameType="Primary Name">
<NameValue>
<FirstName>Nourirtg</FirstName>
</NameValue>
</Name>
</NameDetails>
<Descriptions>
<Description Description1="1" />
<Description Description1="1" Description2="1" />
</Descriptions>
</Person>
<Records>
謝謝:-)提前。
@Rupesh你能幫我解決這個問題嗎? –
你能分享預期的產出結構嗎? –
我的輸出是:政治暴露人(PEP);政治暴露人(PEP);制裁列表 Reason_Listed> 預期輸出:政治暴露人(PEP);制裁列表 Reason_Listed> @ AniketV –