Prośba o pomoc przy tworzeniu XSL, Export z relacyjnej bazy danych |
Prośba o pomoc przy tworzeniu XSL, Export z relacyjnej bazy danych |
18.03.2017, 16:06:41
Post
#1
|
|
Grupa: Zarejestrowani Postów: 1 Pomógł: 0 Dołączył: 17.03.2017 Ostrzeżenie: (0%) |
Szanowni Koledzy,
Bardzo proszę o pomoc w poprawie XSL stylesheet (w załaczniku). Chciałbym dopasować eksport danych w formacie XML z mojej bazy danych do wymogów JPK (załącznik) Przykładowy dobry eksport z urwaną lwią częścią danych w środku również przedstawiam w załączniku "Przykład.xml" natomiast struktura idealna w sensie biorąca pod uwagę wszystkie możliwe pola danych jakie mogą wystąpić jest w pliku "JPK_VAT_wariant_2_wersja_1-0_wzór.xml" Napisany przeze mnie plik XSL odnoszący się (błędnie) do tabeli o nazwie "T11_JPK" również znajduje się w plikach pod nazwą "JPK_Template.xsl" To co otrzymuje z programu poprzez wbudowany stylsheet "Zły_wynik.xml" po załadowaniu mojego XSL nie działa w ogole eksport danych . Same przykładowe dane w formie *.csv znajdują się w pliku "Dane.csv" w takiej strukturze obecne są w bazie danych. Będę niezmiernie wdzięczny za pomoc. Pliki znajdują się pod tym adresem:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://www.filemaker.com/fmpdsoresult" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="ns0 xs"> <xsl:output method="xml" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <xsl:variable name="var1_initial" select="."/> <JPK xmlns="http://jpk.mf.gov.pl/wzor/2016/10/26/10261/" xmlns:kck="http://crd.gov.pl/xml/schematy/dziedzinowe/mf/2013/05/23/eD/KodyCECHKRAJOW/" xmlns:etd="http://crd.gov.pl/xml/schematy/dziedzinowe/mf/2016/01/25/eD/DefinicjeTypy/"> <xsl:attribute name="xsi:schemaLocation" namespace="http://www.w3.org/2001/XMLSchema-instance">http://jpk.mf.gov.pl/wzor/2016/10/26/10261/ file:///C:/Users/Quarku/Downloads/Jednolity%20plik%20kontrolny/Schemat_JPK_VAT(2)_v1-0.xsd</xsl:attribute> <Naglowek> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var2_cur" select="."/> <KodFormularza> <xsl:attribute name="kodSystemowy" namespace=""> <xsl:value-of select="ns0:ROW/ns0:kodSystemowy"/> </xsl:attribute> <xsl:attribute name="wersjaSchemy" namespace=""> <xsl:value-of select="ns0:ROW/ns0:wersjaSchemy"/> </xsl:attribute> <xsl:value-of select="ns0:ROW/ns0:KodFormularza"/> </KodFormularza> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var3_cur" select="."/> <WariantFormularza> <xsl:value-of select="number(ns0:ROW/ns0:WariantFormularza)"/> </WariantFormularza> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var4_cur" select="."/> <CelZlozenia> <xsl:value-of select="number(ns0:ROW/ns0:CelZlozenia)"/> </CelZlozenia> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var5_cur" select="."/> <DataWytworzeniaJPK> <xsl:value-of select="ns0:ROW/ns0:DataWytworzeniaJPK"/> </DataWytworzeniaJPK> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var6_cur" select="."/> <DataOd> <xsl:value-of select="ns0:ROW/ns0:DataOd"/> </DataOd> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var7_cur" select="."/> <DataDo> <xsl:value-of select="ns0:ROW/ns0:DataDo"/> </DataDo> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var8_cur" select="."/> <DomyslnyKodWaluty> <xsl:value-of select="ns0:ROW/ns0:DomyslnyKodWaluty"/> </DomyslnyKodWaluty> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var9_cur" select="."/> <KodUrzedu> <xsl:value-of select="number(ns0:ROW/ns0:KodUrzedu)"/> </KodUrzedu> </xsl:for-each> </Naglowek> <Podmiot1> <IdentyfikatorPodmiotu> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var10_cur" select="."/> <etd:NIP> <xsl:value-of select="number(ns0:ROW/ns0:NIP)"/> </etd:NIP> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var11_cur" select="."/> <etd:PelnaNazwa> <xsl:value-of select="ns0:ROW/ns0:PelnaNazwa"/> </etd:PelnaNazwa> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var12_cur" select="."/> <etd:REGON> <xsl:value-of select="number(ns0:ROW/ns0:REGON)"/> </etd:REGON> </xsl:for-each> </IdentyfikatorPodmiotu> <AdresPodmiotu> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var13_cur" select="."/> <KodKraju> <xsl:value-of select="ns0:ROW/ns0:KodKraju"/> </KodKraju> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var14_cur" select="."/> <Wojewodztwo> <xsl:value-of select="ns0:ROW/ns0:Wojewodztwo"/> </Wojewodztwo> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var15_cur" select="."/> <Powiat> <xsl:value-of select="ns0:ROW/ns0:Powiat"/> </Powiat> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var16_cur" select="."/> <Gmina> <xsl:value-of select="ns0:ROW/ns0:Gmina"/> </Gmina> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var17_cur" select="."/> <Ulica> <xsl:value-of select="ns0:ROW/ns0:Ulica"/> </Ulica> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var18_cur" select="."/> <NrDomu> <xsl:value-of select="number(ns0:ROW/ns0:NrDomu)"/> </NrDomu> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var19_cur" select="."/> <NrLokalu/> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var20_cur" select="."/> <Miejscowosc> <xsl:value-of select="ns0:ROW/ns0:Miejscowosc"/> </Miejscowosc> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var21_cur" select="."/> <KodPocztowy> <xsl:value-of select="ns0:ROW/ns0:KodPocztowy"/> </KodPocztowy> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var22_cur" select="."/> <Poczta> <xsl:value-of select="ns0:ROW/ns0:Poczta"/> </Poczta> </xsl:for-each> </AdresPodmiotu> </Podmiot1> <SprzedazWiersz> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var23_cur" select="."/> <xsl:attribute name="typ" namespace=""> <xsl:value-of select="ns0:ROW/ns0:typSprzedazy"/> </xsl:attribute> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var24_cur" select="."/> <LpSprzedazy> <xsl:value-of select="number(ns0:ROW/ns0:LpSprzedazy)"/> </LpSprzedazy> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var25_cur" select="."/> <NrKontrahenta> <xsl:value-of select="number(ns0:ROW/ns0:NrKontrahenta)"/> </NrKontrahenta> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var26_cur" select="."/> <NazwaKontrahenta> <xsl:value-of select="ns0:ROW/ns0:NazwaKontrahenta"/> </NazwaKontrahenta> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var27_cur" select="."/> <AdresKontrahenta> <xsl:value-of select="ns0:ROW/ns0:AdresKontrahenta"/> </AdresKontrahenta> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var28_cur" select="."/> <DowodSprzedazy> <xsl:value-of select="ns0:ROW/ns0:DowodSprzedazy"/> </DowodSprzedazy> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var29_cur" select="."/> <DataWystawienia> <xsl:value-of select="ns0:ROW/ns0:DataWystawienia"/> </DataWystawienia> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var30_cur" select="."/> <DataSprzedazy> <xsl:value-of select="ns0:ROW/ns0:DataSprzedazy"/> </DataSprzedazy> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var31_cur" select="."/> <K_10> <xsl:value-of select="number(ns0:ROW/ns0:K_10)"/> </K_10> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var32_cur" select="."/> <K_13> <xsl:value-of select="number(ns0:ROW/ns0:K_13)"/> </K_13> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var33_cur" select="."/> <K_15> <xsl:value-of select="number(ns0:ROW/ns0:K_15)"/> </K_15> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var34_cur" select="."/> <K_16> <xsl:value-of select="number(ns0:ROW/ns0:K_16)"/> </K_16> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var35_cur" select="."/> <K_17> <xsl:value-of select="number(ns0:ROW/ns0:K_17)"/> </K_17> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var36_cur" select="."/> <K_18> <xsl:value-of select="number(ns0:ROW/ns0:K_18)"/> </K_18> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var37_cur" select="."/> <K_19> <xsl:value-of select="number(ns0:ROW/ns0:K_19)"/> </K_19> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var38_cur" select="."/> <K_20> <xsl:value-of select="number(ns0:ROW/ns0:K_20)"/> </K_20> </xsl:for-each> </SprzedazWiersz> <SprzedazCtrl> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var39_cur" select="."/> <LiczbaWierszySprzedazy/> </xsl:for-each> <xsl:for-each select="ns0:FMPDSORESULT"> <xsl:variable name="var40_cur" select="."/> <PodatekNalezny/> </xsl:for-each> </SprzedazCtrl> </JPK> </xsl:template> </xsl:stylesheet> działa ale tylko dla jednego recordu z bazy jednocześnie - może ktoś wie jak zrobic loop? |
|
|
Wersja Lo-Fi | Aktualny czas: 27.09.2024 - 08:15 |