我正在使用 saxon 9he、eclipse、tomcat 7。我将解释代码。当我运行转换时,我得到了我想要的所有值,除了 InsurerId。如果我(在调试中)将 xml 更改为 InsurerId2 和 xsl 以获取 InsurerId2 的值,它可以工作。我有两个字段给我带来了这个麻烦,我曾经能够在我添加更改为 xsl 2.0、从 saxon 6 更改、添加当前日期函数之间得到这个。这非常令人困惑,请帮助。
xml
<PersDriver id="001">
<ItemIdInfo>
<InsurerId>001</InsurerId>
</ItemIdInfo>
<GeneralPartyInfo>
<NameInfo>
<PersonName>
<Surname>test</Surname>
<GivenName>test</GivenName>
<OtherGivenName>
</OtherGivenName>
<TitlePrefix>
</TitlePrefix>
<NameSuffix>
</NameSuffix>
</PersonName>
<TaxIdentity>
<TaxIdTypeCd>SSN</TaxIdTypeCd>
<TaxId> 999999999999</TaxId>
</TaxIdentity>
</NameInfo>
</GeneralPartyInfo>
<DriverInfo>
<PersonInfo>
<GenderCd>M</GenderCd>
<BirthDt>1979-08-23</BirthDt>
<MaritalStatusCd>
</MaritalStatusCd>
</PersonInfo>
<DriversLicense>
<LicensedDt>2007-08-23</LicensedDt>
<DriversLicenseNumber>99999999</DriversLicenseNumber>
<StateProvCd>TN</StateProvCd>
</DriversLicense>
</DriverInfo>
<PersDriverInfo>
<DefensiveDriverDt />
<DriverRelationshipToApplicantCd>
</DriverRelationshipToApplicantCd>
<DriverTrainingInd />
<GoodDriverInd />
<GoodStudentCd />
</PersDriverInfo>
</PersDriver>
xsl
<xsl:for-each select="$RsXml/InsuranceSvcRs/com.csc_PolicyOrderCurrentCarrierInqRs/PersDriver">
<driver type_code="DP" id="0">
<prefix>
<xsl:value-of select="GeneralPartyInfo/NameInfo/PersonName/TitlePrefix"/>
</prefix>
<firstname>
<xsl:value-of select="GeneralPartyInfo/NameInfo/PersonName/GivenName"/>
</firstname>
<midname/>
<lastname>
<xsl:value-of select="GeneralPartyInfo/NameInfo/PersonName/Surname"/>
</lastname>
<suffix>
<xsl:value-of select="GeneralPartyInfo/NameInfo/PersonName/NameSuffix"/>
</suffix>
<sex>
<xsl:value-of select="DriverInfo/PersonInfo/GenderCd"/>
</sex>
<dateofbirth>
<xsl:value-of select="DriverInfo/PersonInfo/BirthDt"/>
</dateofbirth>
<ssn>
<xsl:value-of select="GeneralPartyInfo/NameInfo/TaxIdentity/TaxId"/>
</ssn>
<maritalstatus>
<xsl:value-of select="DriverInfo/PersonInfo/MaritalStatusCd"/>
</maritalstatus>
<occupation/>
<homephone/>
<workphone/>
<cellphone/>
<homeemail/>
<workemail/>
<licensestate>
<xsl:value-of select="DriverInfo/DriversLicense/StateProvCd"/>
</licensestate>
<licensenumber>
<xsl:value-of select="DriverInfo/DriversLicense/DriversLicenseNumber"/>
</licensenumber>
<xsl:message>
<TEST>
<xsl:value-of select="ItemIdInfo/InsurerId"/>
</TEST>
</xsl:message>
<xsl:choose>
<xsl:when test="@id=001">
<namedinsured>true</namedinsured>
</xsl:when>
<xsl:otherwise>
<namedinsured>false</namedinsured>
</xsl:otherwise>
</xsl:choose>
<namedinsured2></namedinsured2>
<driver></driver>
<livewithparents/>
<vehicledriven/>
<driveworkschool/>
<keptatcollege/>
<beensuspended/>
<business></business>
<beenarrested/>
<client_id></client_id>
<violations/>
<accidents/>
</driver>
</xsl:for-each>
</xsl:copy>
</xsl:template>