0
由於某些原因,我正在使用XSLT使用Crystal Report 2011導出,並且無法在XSLT中使用標記名稱空間別名。使用1個XSLT從XML輸出中刪除名稱空間
我有以下XSLT: -
<xsl:namespace-alias stylesheet-prefix="b" result-prefix="#default"/>
<xsl:template match="/b:CrystalReport">
<root>
<xsl:for-each select="b:Details">
<person>
<VRN><xsl:value-of select="b:Section/b:Field[@Name='ITMVEHICLEREGNUM1']/b:FormattedValue"/></VRN>
<Make><xsl:value-of select="b:Section/b:Field[@Name='ITMMANUDESC1']/b:FormattedValue"/></Make>
<Model><xsl:value-of select="b:Section/b:Field[@Name='ITMODELDESC1']/b:FormattedValue"/></Model>
<PolicyNumber><xsl:value-of select="b:Section/b:Field[@Name='POLEXTERNAL11']/b:FormattedValue"/></PolicyNumber>
<Title><xsl:value-of select="b:Section/b:Field[@Name='TITDESCRIPTION1']/b:FormattedValue"/></Title>
<FirstName><xsl:value-of select="b:Section/b:Field[@Name='CLIFIRST1']/b:FormattedValue"/></FirstName>
<LastName><xsl:value-of select="b:Section/b:Field[@Name='CLISURN1']/b:FormattedValue"/></LastName>
<PostCode><xsl:value-of select="b:Section/b:Field[@Name='ADRPOSTCODE1']/b:FormattedValue"/></PostCode>
<CoverStartDate><xsl:value-of select="b:Section/b:Field[@Name='POLRENDATE1']/b:FormattedValue"/></CoverStartDate>
<CoverEndDate><xsl:value-of select="b:Section/b:Field[@Name='POLENDDATE1']/b:FormattedValue"/></CoverEndDate>
<FullyComp><xsl:value-of select="b:Section/b:Field[@Name='ITMCOVERTYPECDE1']/b:FormattedValue"/></FullyComp>
<GlassLimit>500</GlassLimit>
<GlassExcess>75</GlassExcess>
<VatReg><xsl:value-of select="b:Section/b:Field[@Name='CLIVATREG1']/b:FormattedValue"/></VatReg>
<AccidentDamageExecess>N/A</AccidentDamageExecess>
<RepairExcess>0.00</RepairExcess>
<Insurer><xsl:value-of select="b:Section/b:Field[@Name='INSNAME1']/b:FormattedValue"/></Insurer>
<Referral><xsl:value-of select="b:Section/b:Field[@Name='CENDESC1']/b:FormattedValue"/></Referral>
</person>
</xsl:for-each>
</root>
</xsl:template>
</xsl:stylesheet>
輸出看起來像: -
<root xmlns:b="urn:crystal-reports:schemas:report-detail">
<person>
<VRN>XXXXXX</VRN>
<Make>AUSTIN</Make>
<Model>A35</Model>
<PolicyNumber>XXXXXXXX</PolicyNumber>
<Title>Mr</Title>
<FirstName>Gareth</FirstName>
<LastName>Jones</LastName>
<PostCode>AL23 6TR</PostCode>
<CoverStartDate>06.04.2011</CoverStartDate>
<CoverEndDate>05.04.2012</CoverEndDate>
<FullyComp>01</FullyComp>
<GlassLimit>500</GlassLimit>
<GlassExcess>75</GlassExcess>
<VatReg></VatReg>
<AccidentDamageExecess>N/A</AccidentDamageExecess>
<RepairExcess>0.00</RepairExcess>
<Insurer>My Insurer</Insurer>
<Referral>Direct</Referral>
</person>
</root>
我需要能夠從標籤中刪除命名空間,只能使用1個XSLT來完成它。
任何幫助表示讚賞。
感謝 克雷格
JLRishe你是個明星,非常感謝完美的作品。 – Craig