Xml разрыв строки не читается в xslt - PullRequest
0 голосов
/ 11 ноября 2019

Я пытаюсь преобразовать xml-файл в html, используя xslt. Но я не могу получить разрыв строки xml в html file.line. Символ разрыва не читается в моем xslt-файле. Как получить этот разрыв в html file.i, попробуйте использоватьРешите эту проблему, но она не работает. Я получаю сообщение об ошибке, чтобы xml-параметры не могли использоваться внутри xml-if.

Xml-файл

<?xml version="1.0" encoding="utf-8"?>
    <inv:Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:inv="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:us="http://unicornsolutions.com">
        <UBLExtensions xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
            <UBLExtension xmlns:sig="urn:oasis:names:specification:ubl:schema:xsd:CommonSignatureComponents-2" xmlns:sbc="urn:oasis:names:specification:ubl:schema:xsd:SignatureBasicComponents-2">
                <ExtensionContent>
                    <us:ExtensionFields>
                        <us:Doctype>DW</us:Doctype>
                        <us:ActivityCode>20143</us:ActivityCode>
                        <us:Custom>
                            <us:Interest>
                                <us:InterestDetails>
                                    <us:BaseItemDetails>
                                        <us:LineItemNum>1</us:LineItemNum>
                                        <us:Reference>11610</us:Reference>
                                        <us:Description>InterestItem</us:Description>
                                        <us:Amount>2000.00</us:Amount>
                                        <us:FromDate>2019-08-16</us:FromDate>
                                        <us:ToDate>2019-10-16</us:ToDate>
                                        <us:NumberOfDays>61</us:NumberOfDays>
                                        <us:InterestRate>8.75</us:InterestRate>
                                        <us:InterestAmount>29.25</us:InterestAmount>
                                    </us:BaseItemDetails>
                                </us:InterestDetails>
                                <us:InterestSummary>
                                    <us:TotalAmount>29.25</us:TotalAmount>
                                </us:InterestSummary>
                            </us:Interest>
                        </us:Custom>
                        <us:InvoiceSummary>
                            <us:InvoiceTotals>
                                <us:LineItemTotalsAmount>2229.25</us:LineItemTotalsAmount>
                                <us:DiscountTotalsAmount>0.00</us:DiscountTotalsAmount>
                                <us:ChargesTotalsAmount>0.00</us:ChargesTotalsAmount>
                                <us:TaxTotalsAmount>0.00</us:TaxTotalsAmount>
                                <us:GrossAmount>2229.25</us:GrossAmount>
                                <us:VatTotalsAmount>0.00</us:VatTotalsAmount>
                                <us:NetAmount>2229.25</us:NetAmount>
                                <us:RoundingAmount>0.00</us:RoundingAmount>
                            </us:InvoiceTotals>
                        </us:InvoiceSummary>
                    </us:ExtensionFields>
                </ExtensionContent>
            </UBLExtension>
        </UBLExtensions>
        <cbc:UBLVersionID>2.1</cbc:UBLVersionID>
        <cbc:CustomizationID>urn:www.cenbii.eu:transaction:biitrns010:ver2.0:extended:urn:www.peppol.eu:bis:peppol5a:ver2.0:extended:urn:www.difi.no:ehf:faktura:ver2.0</cbc:CustomizationID>
        <cbc:ProfileID>urn:www.cenbii.eu:profile:bii05:ver2.0</cbc:ProfileID>
        <cbc:ID>1000790</cbc:ID>
        <cbc:IssueDate>2019-10-16</cbc:IssueDate>
        <cbc:InvoiceTypeCode listID="UNCL1001">380</cbc:InvoiceTypeCode>
        <cbc:TaxPointDate>2019-08-15</cbc:TaxPointDate>
        <cbc:DocumentCurrencyCode listID="ISO4217">NOK</cbc:DocumentCurrencyCode>
        <cac:InvoicePeriod>
            <cbc:StartDate>2019-10-16</cbc:StartDate>
            <cbc:EndDate>2019-10-30</cbc:EndDate>
        </cac:InvoicePeriod>
        <cac:AdditionalDocumentReference>
            <cbc:ID>2019-10-30</cbc:ID>
            <cbc:DocumentType>LetterDueDate</cbc:DocumentType>
        </cac:AdditionalDocumentReference>
        <cac:AdditionalDocumentReference>
            <cbc:ID>0.00</cbc:ID>
            <cbc:DocumentType>BOFee</cbc:DocumentType>
        </cac:AdditionalDocumentReference>
        <cac:AdditionalDocumentReference>
            <cbc:ID>0.00</cbc:ID>
            <cbc:DocumentType>DCFFee</cbc:DocumentType>
        </cac:AdditionalDocumentReference>
        <cac:AdditionalDocumentReference>
            <cbc:ID>0</cbc:ID>
            <cbc:DocumentType>Noofdaystilldcf</cbc:DocumentType>
        </cac:AdditionalDocumentReference>
        <cac:AdditionalDocumentReference>
            <cbc:ID>1000790</cbc:ID>
            <cbc:DocumentType>DebtorPortalUserName</cbc:DocumentType>
        </cac:AdditionalDocumentReference>
        <cac:AdditionalDocumentReference>
            <cbc:ID>J85JZTE</cbc:ID>
            <cbc:DocumentType>DebtorPortalPassword</cbc:DocumentType>
        </cac:AdditionalDocumentReference>
        <cac:AdditionalDocumentReference>
            <cbc:ID>0.00</cbc:ID>
            <cbc:DocumentType>PaidAmount</cbc:DocumentType>
        </cac:AdditionalDocumentReference>
        <cac:AdditionalDocumentReference>
            <cbc:ID>2229.25</cbc:ID>
            <cbc:DocumentType>Balance</cbc:DocumentType>
        </cac:AdditionalDocumentReference>
        <cac:AdditionalDocumentReference>
            <cbc:ID>B2BFairEHF</cbc:ID>
            <cbc:DocumentType>H1</cbc:DocumentType>
        </cac:AdditionalDocumentReference>
        <cac:AdditionalDocumentReference>
            <cbc:ID>Viser til faktura fra Vegamot AS - Avtale. &#10;

    De ikke har mottatt betaling fra deg, og Fair Collection AS sender deg derfor denne betalingsoppfordringen. &#10;

    På denne siden av arket vil du finne faktura- og betalingsinformasjon. På baksiden kan du lese om hvordan vi best mulig kan hjelpe deg via vår kundeportal. </cbc:ID>
            <cbc:DocumentType>H1P1</cbc:DocumentType>
        </cac:AdditionalDocumentReference>
        <cac:AdditionalDocumentReference>
            <cbc:ID>D35F1C43-752D-4BD6-90CB-7F6E5C4D83F8</cbc:ID>
            <cbc:DocumentType>DocumentReference</cbc:DocumentType>
        </cac:AdditionalDocumentReference>
        <cac:AdditionalDocumentReference>
            <cbc:ID>DEBT_COLLECTION_NOTICE</cbc:ID>
            <cbc:DocumentType>DocType</cbc:DocumentType>
        </cac:AdditionalDocumentReference>
        <cac:AdditionalDocumentReference>
            <cbc:ID>11000790540</cbc:ID>
            <cbc:DocumentType>KID</cbc:DocumentType>
        </cac:AdditionalDocumentReference>
        <cac:AdditionalDocumentReference>
            <cbc:ID>2019-10-30</cbc:ID>
            <cbc:DocumentType>PaymentDueDate</cbc:DocumentType>
        </cac:AdditionalDocumentReference>
        <cac:AdditionalDocumentReference>
            <cbc:ID>20143</cbc:ID>
            <cbc:DocumentType>ActivityCode</cbc:DocumentType>
        </cac:AdditionalDocumentReference>
        <cac:AdditionalDocumentReference>
            <cbc:ID>0.00</cbc:ID>
            <cbc:DocumentType>PaymentDueAmount</cbc:DocumentType>
        </cac:AdditionalDocumentReference>
        <cac:AccountingSupplierParty>
            <cac:Party>
                <cac:PartyIdentification>
                    <cbc:ID schemeID="NO:ORGNR">935162718</cbc:ID>
                </cac:PartyIdentification>
                <cac:PartyName>
                    <cbc:Name>Vegamot AS - Avtale</cbc:Name>
                </cac:PartyName>
                <cac:PostalAddress>
                    <cbc:CityName>OSLO</cbc:CityName>
                    <cbc:PostalZone>0483</cbc:PostalZone>
                    <cac:AddressLine>
                        <cbc:Line>0483 OSLO</cbc:Line>
                    </cac:AddressLine>
                    <cac:Country>
                        <cbc:IdentificationCode listID="ISO3166-1:Alpha2">NO</cbc:IdentificationCode>
                    </cac:Country>
                </cac:PostalAddress>
                <cac:PartyTaxScheme>
                    <cbc:CompanyID schemeID="NO:VAT">935162718MVA</cbc:CompanyID>
                    <cac:TaxScheme>
                        <cbc:ID>VAT</cbc:ID>
                    </cac:TaxScheme>
                </cac:PartyTaxScheme>
                <cac:PartyLegalEntity>
                    <cbc:RegistrationName>Vegamot AS - Avtale</cbc:RegistrationName>
                    <cbc:CompanyID schemeID="NO:ORGNR">935162718</cbc:CompanyID>
                </cac:PartyLegalEntity>
            </cac:Party>
        </cac:AccountingSupplierParty>
        <cac:AccountingCustomerParty>
            <cac:Party>
                <cac:PartyIdentification>
                    <cbc:ID schemeID="NO:ORGNR">997850211</cbc:ID>
                </cac:PartyIdentification>
                <cac:PartyIdentification>
                    <cbc:ID schemeID="ZZZ">cid:80398215</cbc:ID>
                </cac:PartyIdentification>
                <cac:PartyName>
                    <cbc:Name>Tluk-Transport</cbc:Name>
                </cac:PartyName>
                <cac:PostalAddress>
                    <cbc:CityName>TILLER</cbc:CityName>
                    <cbc:PostalZone>7091</cbc:PostalZone>
                    <cac:AddressLine>
                        <cbc:Line>Tonstadbrinken 95</cbc:Line>
                    </cac:AddressLine>
                    <cac:AddressLine>
                        <cbc:Line>7091 TILLER</cbc:Line>
                    </cac:AddressLine>
                    <cac:Country>
                        <cbc:IdentificationCode listID="ISO3166-1:Alpha2">NO</cbc:IdentificationCode>
                    </cac:Country>
                </cac:PostalAddress>
                <cac:PartyTaxScheme>
                    <cac:TaxScheme>
                        <cbc:ID>VAT</cbc:ID>
                    </cac:TaxScheme>
                </cac:PartyTaxScheme>
                <cac:PartyLegalEntity>
                    <cbc:RegistrationName>Tluk-Transport</cbc:RegistrationName>
                    <cbc:CompanyID schemeID="NO:ORGNR">997850211</cbc:CompanyID>
                </cac:PartyLegalEntity>
                <cac:Contact>
                    <cbc:ID>80398215</cbc:ID>
                    <cbc:Name>Tluk-Transport</cbc:Name>
                </cac:Contact>
            </cac:Party>
        </cac:AccountingCustomerParty>
        <cac:PayeeParty>
            <cac:PartyIdentification>
                <cbc:ID schemeID="NO:ORGNR">920999360</cbc:ID>
            </cac:PartyIdentification>
            <cac:PartyName>
                <cbc:Name>Fair Collection AS</cbc:Name>
            </cac:PartyName>
            <cac:PostalAddress>
                <cbc:CityName>Oslo</cbc:CityName>
                <cbc:PostalZone>0412</cbc:PostalZone>
                <cac:AddressLine>
                    <cbc:Line>Postboks 45 Torshov</cbc:Line>
                </cac:AddressLine>
                <cac:AddressLine>
                    <cbc:Line>0412 Oslo</cbc:Line>
                </cac:AddressLine>
                <cac:Country>
                    <cbc:IdentificationCode listID="ISO3166-1:Alpha2">NO</cbc:IdentificationCode>
                </cac:Country>
            </cac:PostalAddress>
            <cac:PartyLegalEntity>
                <cbc:RegistrationName>Fair Collection AS</cbc:RegistrationName>
                <cbc:CompanyID schemeID="NO:ORGNR">920999360</cbc:CompanyID>
            </cac:PartyLegalEntity>
        </cac:PayeeParty>
        <cac:PaymentMeans>
            <cbc:PaymentMeansCode listID="UNCL4461">31</cbc:PaymentMeansCode>
            <cbc:PaymentDueDate>2019-10-30</cbc:PaymentDueDate>
            <cbc:PaymentID>11000790540</cbc:PaymentID>
            <cac:PayeeFinancialAccount>
                <cbc:ID schemeID="BBAN">15061356735</cbc:ID>
            </cac:PayeeFinancialAccount>
        </cac:PaymentMeans>
        <cac:PaymentMeans>
            <cbc:PaymentMeansCode listID="UNCL4461">31</cbc:PaymentMeansCode>
            <cbc:PaymentDueDate>2019-10-30</cbc:PaymentDueDate>
            <cbc:PaymentID>11000790540</cbc:PaymentID>
            <cac:PayeeFinancialAccount>
                <cbc:ID schemeID="IBAN">NO3515061356735</cbc:ID>
                <cac:FinancialInstitutionBranch>
                    <cac:FinancialInstitution>
                        <cbc:ID schemeID="BIC">DNBANOKK</cbc:ID>
                    </cac:FinancialInstitution>
                </cac:FinancialInstitutionBranch>
            </cac:PayeeFinancialAccount>
        </cac:PaymentMeans>
        <cac:AllowanceCharge>
            <cbc:ChargeIndicator>true</cbc:ChargeIndicator>
            <cbc:AllowanceChargeReason>Collection Amount</cbc:AllowanceChargeReason>
            <cbc:Amount currencyID="NOK">200.00</cbc:Amount>
            <cac:TaxCategory>
                <cbc:ID schemeID="UNCL5305">E</cbc:ID>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:TaxCategory>
        </cac:AllowanceCharge>
        <cac:AllowanceCharge>
            <cbc:ChargeIndicator>true</cbc:ChargeIndicator>
            <cbc:AllowanceChargeReason>Other Cost</cbc:AllowanceChargeReason>
            <cbc:Amount currencyID="NOK">0.00</cbc:Amount>
            <cac:TaxCategory>
                <cbc:ID schemeID="UNCL5305">E</cbc:ID>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:TaxCategory>
        </cac:AllowanceCharge>
        <cac:TaxTotal>
            <cbc:TaxAmount currencyID="NOK">0</cbc:TaxAmount>
            <cac:TaxSubtotal>
                <cbc:TaxableAmount currencyID="NOK">2229.25</cbc:TaxableAmount>
                <cbc:TaxAmount currencyID="NOK">0</cbc:TaxAmount>
                <cac:TaxCategory>
                    <cbc:ID schemeID="UNCL5305">E</cbc:ID>
                    <cbc:Percent>0</cbc:Percent>
                    <cbc:TaxExemptionReason>Not applicable</cbc:TaxExemptionReason>
                    <cac:TaxScheme>
                        <cbc:ID>VAT</cbc:ID>
                    </cac:TaxScheme>
                </cac:TaxCategory>
            </cac:TaxSubtotal>
        </cac:TaxTotal>
        <cac:LegalMonetaryTotal>
            <cbc:LineExtensionAmount currencyID="NOK">2029.25</cbc:LineExtensionAmount>
            <cbc:TaxExclusiveAmount currencyID="NOK">2229.25</cbc:TaxExclusiveAmount>
            <cbc:TaxInclusiveAmount currencyID="NOK">2229.25</cbc:TaxInclusiveAmount>
            <cbc:AllowanceTotalAmount currencyID="NOK">0.00</cbc:AllowanceTotalAmount>
            <cbc:ChargeTotalAmount currencyID="NOK">200.00</cbc:ChargeTotalAmount>
            <cbc:PrepaidAmount currencyID="NOK">0.00</cbc:PrepaidAmount>
            <cbc:PayableRoundingAmount currencyID="NOK">0.00</cbc:PayableRoundingAmount>
            <cbc:PayableAmount currencyID="NOK">2229.25</cbc:PayableAmount>
        </cac:LegalMonetaryTotal>
        <cac:InvoiceLine>
            <cbc:ID>1</cbc:ID>
            <cbc:InvoicedQuantity unitCode="NAR" unitCodeListID="UNECERec20">1</cbc:InvoicedQuantity>
            <cbc:LineExtensionAmount currencyID="NOK">2000.00</cbc:LineExtensionAmount>
            <cbc:AccountingCost>565656565</cbc:AccountingCost>
            <cac:InvoicePeriod>
                <cbc:StartDate>2019-08-01</cbc:StartDate>
                <cbc:EndDate>2019-08-15</cbc:EndDate>
            </cac:InvoicePeriod>
            <cac:OrderLineReference>
                <cbc:LineID>0</cbc:LineID>
            </cac:OrderLineReference>
            <cac:Item>
                <cbc:Name>MainAmount</cbc:Name>
                <cac:ClassifiedTaxCategory>
                    <cbc:ID schemeID="UNCL5305">E</cbc:ID>
                    <cac:TaxScheme>
                        <cbc:ID>VAT</cbc:ID>
                    </cac:TaxScheme>
                </cac:ClassifiedTaxCategory>
            </cac:Item>
            <cac:Price>
                <cbc:PriceAmount currencyID="NOK">2000.00</cbc:PriceAmount>
            </cac:Price>
        </cac:InvoiceLine>
        <cac:InvoiceLine>
            <cbc:ID>248583</cbc:ID>
            <cbc:InvoicedQuantity unitCode="DAY" unitCodeListID="UNECERec20">61</cbc:InvoicedQuantity>
            <cbc:LineExtensionAmount currencyID="NOK">29.25</cbc:LineExtensionAmount>
            <cac:InvoicePeriod>
                <cbc:StartDate>2019-08-16</cbc:StartDate>
                <cbc:EndDate>2019-10-16</cbc:EndDate>
            </cac:InvoicePeriod>
            <cac:OrderLineReference>
                <cbc:LineID>565656565</cbc:LineID>
            </cac:OrderLineReference>
            <cac:Item>
                <cbc:Name>Interest</cbc:Name>
                <cac:ClassifiedTaxCategory>
                    <cbc:ID schemeID="UNCL5305">E</cbc:ID>
                    <cac:TaxScheme>
                        <cbc:ID>VAT</cbc:ID>
                    </cac:TaxScheme>
                </cac:ClassifiedTaxCategory>
                <cac:AdditionalItemProperty>
                    <cbc:Name>Amount</cbc:Name>
                    <cbc:Value>2000.00</cbc:Value>
                </cac:AdditionalItemProperty>
                <cac:AdditionalItemProperty>
                    <cbc:Name>InterestRate</cbc:Name>
                    <cbc:Value>8.75</cbc:Value>
                </cac:AdditionalItemProperty>
            </cac:Item>
            <cac:Price>
                <cbc:PriceAmount currencyID="NOK">175.00</cbc:PriceAmount>
                <cbc:BaseQuantity>365</cbc:BaseQuantity>
            </cac:Price>
        </cac:InvoiceLine>
    </inv:Invoice>

Xslt-файл ##

 <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="http://www.stylusstudio.com/xquery" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:inv="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">

        <xsl:template match="/">

            <html>
            <head>
            </head>
    <body  style = "background: white;
      width: 21cm;
      height: 29.7cm;
      display: block;
      margin: 0 auto;
      margin-bottom: 0.5cm; ">
    <xsl:for-each select="inv:Invoice/cac:AdditionalDocumentReference">
    <xsl:if test="cbc:DocumentType = 'H1P1' ">
      <xsl:value-of select="cbc:ID"/>
     </xsl:if>
    </xsl:for-each> 
    </body>
            </html>
        </xsl:template>
    </xsl:stylesheet>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...