0

I am using Crystal Report 2011 Export using XSLT and cannot use the tag namespace-alias in the XSLT for some reason.

I have the following 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>

The output looks like :-

    <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>

I need to be able to remove the namespace from the tag and can only use 1 XSLT to do it.

Any help appreciated.

Thanks Craig

4

1 に答える 1

1

ここを使う必要はありませんnamespace-alias。結果はすでに null 名前空間にありますが、名前空間宣言を抑制したい場合はb、次を使用するだけですexclude-result-prefixes

<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:b="urn:crystal-reports:schemas:report-detail"
    exclude-result-prefixes="b">
于 2013-02-05T13:10:18.673 に答える