내 xml 코드에 조건 노드 주소와 파티 요소가 있으면 세미콜론이 파티 이름 뒤에 추가됩니다. 이후 아무 것도 없기 때문에 세미 콜론의 이름 뒤에 아무 것도 입력하고 싶지 않습니다. ** 1048 지역 RD, 세인트 폴, 브라운, 레인 ** :텍스트 조각 사이에 세미콜론을 추가하지만 텍스트 조각의 끝에는 어떻게 삽입합니까?
다음과 같이 고용의 다음 장소 (들)에서 다음 자 (들)에 대한 신청인의 접근이 제한됩니다 다음은 출력 단 하나의 파티 이름이 비록 내 출력 조건 텍스트 요소의 끝에 세미콜론을 표시하고 여기에
55,101 MN. 하나의 파티 이름이있을 때 세미콜론이 표시되지 않도록 xslt를 어떻게 변경합니까?
청원 자에게는 다음 아동 (들)의 유일한 신체적 법적 보호가 부여됩니다. 09
내 XML 코드 :
<Integration xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:tsg="http://tsgweb.com" xmlns:IXML="http://tsgweb.com" xmlns:CMCodeQueryHelper="urn:CMCodeQueryHelper" PackageID="BCA PO Notification" MessageID="57832809" xmlns="">
<ProtectionOrder Op="E" InternalProtectionOrderID="2563" xmlns:user="http://tylertechnologies.com">
<ProtectionOrderParties>
<ProtectionOrderParty InternalPartyID="1614450754">
<ProtectionOrderPartyNames>
<ProtectionOrderPartyName Current="true" InternalNameID="1615262152" FormattedName="Brown, Rayne"/>
</ProtectionOrderPartyNames>
<Added>12/29/2014</Added>
<ProtectionOrderConnection>
<Petitioner>true</Petitioner>
<FilingParty>false</FilingParty>
<ProtectedParty>true</ProtectedParty>
<Minor>false</Minor>
</ProtectionOrderConnection>
<MNProtectionOrderAdditional InternalID="2604" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<Conditions>
<Condition>
<Code Word="03F1EXPC">03.F.1 Respondent must not call/enter place of employment</Code>
<Description>Respondent must not call or enter the place of employment of the following party(ies). This includes all land, parking lots, and buildings of the following addresses:</Description>
<Parties>
<Party InternalPartyID="1614450754"/>
</Parties>
<Addresses>
<Address InternalAddressID="1618211350"/>
</Addresses>
</Condition>
<Condition>
<Code Word="03F2EXPC">03.F.2 Respondent's access at place of employment</Code>
<Description>Respondent's access to the following party(ies) at the following place(s) of employment is limited as follows: </Description>
<Parties>
<Party InternalPartyID="1614450754"/>
</Parties>
<Addresses>
<Address InternalAddressID="1618211350"/>
</Addresses>
</Condition>
</Conditions>
</MNProtectionOrderAdditional>
</ProtectionOrderParty>
</ProtectionOrderParties>
<MNProtectionOrderAdditional InternalID="2559" xmlns:fn="http://www.w3.org/2005/xpath-functions">
</xsl:if>
</MNProtectionOrderAdditional>
</ProtectionOrder>
</Integration>
내 XSLT 코드
<xsl:for-each select="MNProtectionOrderAdditional/Conditions/Condition">
<ext:ProtectionOrderCondition>
<ext:ConditionText>
<xsl:variable name="vCondition">
<xsl:value-of select="normalize-space(Description)"/>
<xsl:text> </xsl:text>
<xsl:for-each select="Parties/Party">
<xsl:for-each select="ancestor::ProtectionOrder/ProtectionOrderParties/ProtectionOrderParty[@InternalPartyID=current()/@InternalPartyID]">
<xsl:value-of select="ProtectionOrderPartyNames/ProtectionOrderPartyName[@Current='true']/@FormattedName"/>
<!--<xsl:text>; </xsl:text>-->
<xsl:if test="position() = last()">
<xsl:text>; </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
<xsl:text> </xsl:text>
<xsl:for-each select="Addresses/Address">
<xsl:for-each select="ancestor::ProtectionOrder/ProtectionOrderParties/ProtectionOrderParty/MNProtectionOrderPartyAdditional/ProtectedAddresses/Address[@InternalAddressID=current()/@InternalAddressID]">
<xsl:if test="AddressLine1">
<xsl:value-of select="AddressLine1"/>
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:if test="AddressLine2">
<xsl:value-of select="AddressLine2"/>
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:if test="AddressLine3">
<xsl:value-of select="AddressLine3"/>
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:if test="AddressLine4">
<xsl:value-of select="AddressLine4"/>
</xsl:if>
<xsl:text>; </xsl:text>
</xsl:for-each>
</xsl:for-each>
</xsl:variable>
<xsl:choose>
<xsl:when test="substring($vCondition,string-length($vCondition)-1,2)='; '">
<xsl:value-of select="substring($vCondition,1,string-length($vCondition)-2)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$vCondition"/>
</xsl:otherwise>
</xsl:choose>
</ext:ConditionText>
<ext:ConditionCode>
<xsl:value-of select="document(concat($gEnvPath,'\ConfigFiles\MNCISCodes\ProtectionOrderConditionCodeMapping.xml'))
/ProtectionOrderConditionCodeMapping/Mapping[MNCISCode=current()/Code/@Word]/BCACode"/>
</ext:ConditionCode>
</ext:ProtectionOrderCondition>
</xsl:for-each>
업데이트 XSLT
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ext="http://www.courts.state.mn.us/ProtectionOrderExtension/1.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template name="ProtectionOrder">
<ext:ProtectionOrder>
<!--ext:ProtectionOrderCondition-->
<xsl:for-each select="MNProtectionOrderAdditional/Conditions/Condition">
<ext:ProtectionOrderCondition>
<ext:ConditionText>
<xsl:variable name="vCondition">
<xsl:value-of select="normalize-space(Description)"/>
<xsl:text> </xsl:text>
<xsl:for-each select="Parties/Party">
<xsl:for-each select="ancestor::ProtectionOrder/ProtectionOrderParties/ProtectionOrderParty[@InternalPartyID=current()/@InternalPartyID]">
<xsl:value-of select="ProtectionOrderPartyNames/ProtectionOrderPartyName[@Current='true']/@FormattedName"/>
</xsl:for-each>
<xsl:if test="position() != last()">
<xsl:text>; </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text> </xsl:text>
<xsl:for-each select="Addresses/Address">
<xsl:for-each select="ancestor::ProtectionOrder/ProtectionOrderParties/ProtectionOrderParty/MNProtectionOrderPartyAdditional/ProtectedAddresses/Address[@InternalAddressID=current()/@InternalAddressID]">
<xsl:if test="AddressLine1">
<xsl:value-of select="AddressLine1"/>
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:if test="AddressLine2">
<xsl:value-of select="AddressLine2"/>
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:if test="AddressLine3">
<xsl:value-of select="AddressLine3"/>
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:if test="AddressLine4">
<xsl:value-of select="AddressLine4"/>
</xsl:if>
<xsl:text>; </xsl:text>
</xsl:for-each>
</xsl:for-each>
</xsl:variable>
<xsl:choose>
<xsl:when test="substring($vCondition,string-length($vCondition)-1,2)='; '">
<xsl:value-of select="substring($vCondition,1,string-length($vCondition)-2)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$vCondition"/>
</xsl:otherwise>
</xsl:choose>
</ext:ConditionText>
<ext:ConditionCode>
<xsl:value-of select="document(concat($gEnvPath,'\ConfigFiles\MNCISCodes\ProtectionOrderConditionCodeMapping.xml'))
/ProtectionOrderConditionCodeMapping/Mapping[MNCISCode=current()/Code/@Word]/BCACode"/>
</ext:ConditionCode>
</ext:ProtectionOrderCondition>
</xsl:for-each>
</ext:ProtectionOrder>
</xsl:template>
</xsl:stylesheet>
는 "* 나는 사람들이 이전이 해결되었습니다 생각하는 것처럼 보이기 때문에 새 게시물을 게시하기로 결정했다. *"그렇게하지 마십시오. –
당신의 조언은 무엇입니까? 그 중 하나를 삭제해야합니까? – user3781064
최근에 많은 질문에 downvote 만 받았고 많은 혼란을 겪었습니까? 한 걸음 물러서서 XSLT의 기초를 살펴볼 시간입니다. [좋은 질문 샘플을 만드는 법]에서 [SO 질문에 대한 기본 사항] (http://stackoverflow.com/help/how-to-ask) _and_ (http://stackoverflow.com/help/mcve). –