1 2 Previous Next 15 Replies Latest reply on Mar 19, 2017 9:42 AM by quarku

    XSL style - proffesional help needed


      Dear friends,


      I would like to ask you for a professional XSL help. I have almost no knowledge in the topic so I knew form the beginning that I would fail - even so I have tried to create my own XSL stylesheet...


      What i need is to get "Proper_result.xml" file from filemaker data organised as you can see in Excel file named "Sample_data.xlsx".


      Unfortunately the nearest file I can get so far, is the file created without stylesheet base on FMPDSORESULT grammar which you can check under the name "My_result.xml".


      I'm getting this error with my stylesheet - "Initial_error.jpg"


      But even without it the result will for sure not be as expected - believe me  !


      My stylesheet - "XSL_stylesheet.xsl"


      I would really appreciate your help or even more - corrected XSL file.


      I wish you all very great weekend.

        • 1. Re: XSL style - proffesional help needed

          Your "raw" FMPDSORESULT should follow this format/grammar:


          The "Proper_result.xml" that you posted does NOT follow this format. (There are no ROW elements, for example).

          However your "My_result.xml" does seem to follow the grammar.


          If your aim is the XSLX, then perhaps an Export as that (or Save As Excel) should be used?


          FMPXMLRESULT is more closely similar to Excel (a "header" in the METADATA).



          • 2. Re: XSL style - proffesional help needed

            Hello there,

            thanks for reply.


            In short my aim is to get xml output similar to "Proper_result.xml" from my database thanks to some kind of XSL stylesheet.


            I have totally no knowledge about XML and XSL - I have just tried to do something.

            • 3. Re: XSL style - proffesional help needed

              The Proper_result.xml is not valid XML.  What do you propose to do with the document once you get it?



              • 4. Re: XSL style - proffesional help needed

                Hello Beverly,


                Out tax regulations require to sent all invoices according to the structure described in new attached file called - description. I know that it's in polish but at least the structure it's shown as graph maybe this will help you.


                I have also attached original example gather form Tax goverment institute - this XML example have to be valid (it's official one).


                Additionally there is XSD structure file - maybe it will help you as well.


                Best regards

                • 5. Re: XSL style - proffesional help needed

                  Did you mean to upload new files? You need to reply and select "Use advanced editor" in the upper-right of the comment box.



                  • 6. Re: XSL style - proffesional help needed

                    They are in main post. on top of this page. all three files with "NEW_" part of the name.


                    I think maybe there is a way to convert XSD file to XSLT

                    • 7. Re: XSL style - proffesional help needed

                      no XSD cannot be converted to XSLT, because you are trying to "map" the export (your data) into the format used by the place you are sending it.

                      the XSD is a "format" of the data you need, but it still needs to be used in a way to make the map.


                      • 8. Re: XSL style - proffesional help needed

                        I have some idea - Mapforce - I will map my xsd with required xsd.

                        • 9. Re: XSL style - proffesional help needed

                          This works fine but it convers only 1 record (im sure that Im exporting all at once):


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


                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var2_cur" select="."/>


                                                  <xsl:attribute name="kodSystemowy" namespace="">

                                                      <xsl:value-of select="ns0:ROW/ns0:kodSystemowy"/>


                                                  <xsl:attribute name="wersjaSchemy" namespace="">

                                                      <xsl:value-of select="ns0:ROW/ns0:wersjaSchemy"/>


                                                  <xsl:value-of select="ns0:ROW/ns0:KodFormularza"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var3_cur" select="."/>


                                                  <xsl:value-of select="number(ns0:ROW/ns0:WariantFormularza)"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var4_cur" select="."/>


                                                  <xsl:value-of select="number(ns0:ROW/ns0:CelZlozenia)"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var5_cur" select="."/>


                                                  <xsl:value-of select="ns0:ROW/ns0:DataWytworzeniaJPK"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var6_cur" select="."/>


                                                  <xsl:value-of select="ns0:ROW/ns0:DataOd"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var7_cur" select="."/>


                                                  <xsl:value-of select="ns0:ROW/ns0:DataDo"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var8_cur" select="."/>


                                                  <xsl:value-of select="ns0:ROW/ns0:DomyslnyKodWaluty"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var9_cur" select="."/>


                                                  <xsl:value-of select="number(ns0:ROW/ns0:KodUrzedu)"/>






                                              <xsl:for-each select="ns0:FMPDSORESULT">

                                                  <xsl:variable name="var10_cur" select="."/>


                                                      <xsl:value-of select="number(ns0:ROW/ns0:NIP)"/>



                                              <xsl:for-each select="ns0:FMPDSORESULT">

                                                  <xsl:variable name="var11_cur" select="."/>


                                                      <xsl:value-of select="ns0:ROW/ns0:PelnaNazwa"/>



                                              <xsl:for-each select="ns0:FMPDSORESULT">

                                                  <xsl:variable name="var12_cur" select="."/>


                                                      <xsl:value-of select="number(ns0:ROW/ns0:REGON)"/>





                                              <xsl:for-each select="ns0:FMPDSORESULT">

                                                  <xsl:variable name="var13_cur" select="."/>


                                                      <xsl:value-of select="ns0:ROW/ns0:KodKraju"/>



                                              <xsl:for-each select="ns0:FMPDSORESULT">

                                                  <xsl:variable name="var14_cur" select="."/>


                                                      <xsl:value-of select="ns0:ROW/ns0:Wojewodztwo"/>



                                              <xsl:for-each select="ns0:FMPDSORESULT">

                                                  <xsl:variable name="var15_cur" select="."/>


                                                      <xsl:value-of select="ns0:ROW/ns0:Powiat"/>



                                              <xsl:for-each select="ns0:FMPDSORESULT">

                                                  <xsl:variable name="var16_cur" select="."/>


                                                      <xsl:value-of select="ns0:ROW/ns0:Gmina"/>



                                              <xsl:for-each select="ns0:FMPDSORESULT">

                                                  <xsl:variable name="var17_cur" select="."/>


                                                      <xsl:value-of select="ns0:ROW/ns0:Ulica"/>



                                              <xsl:for-each select="ns0:FMPDSORESULT">

                                                  <xsl:variable name="var18_cur" select="."/>


                                                      <xsl:value-of select="number(ns0:ROW/ns0:NrDomu)"/>



                                              <xsl:for-each select="ns0:FMPDSORESULT">

                                                  <xsl:variable name="var19_cur" select="."/>



                                              <xsl:for-each select="ns0:FMPDSORESULT">

                                                  <xsl:variable name="var20_cur" select="."/>


                                                      <xsl:value-of select="ns0:ROW/ns0:Miejscowosc"/>



                                              <xsl:for-each select="ns0:FMPDSORESULT">

                                                  <xsl:variable name="var21_cur" select="."/>


                                                      <xsl:value-of select="ns0:ROW/ns0:KodPocztowy"/>



                                              <xsl:for-each select="ns0:FMPDSORESULT">

                                                  <xsl:variable name="var22_cur" select="."/>


                                                      <xsl:value-of select="ns0:ROW/ns0:Poczta"/>






                                          <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:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var24_cur" select="."/>


                                                  <xsl:value-of select="number(ns0:ROW/ns0:LpSprzedazy)"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var25_cur" select="."/>


                                                  <xsl:value-of select="number(ns0:ROW/ns0:NrKontrahenta)"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var26_cur" select="."/>


                                                  <xsl:value-of select="ns0:ROW/ns0:NazwaKontrahenta"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var27_cur" select="."/>


                                                  <xsl:value-of select="ns0:ROW/ns0:AdresKontrahenta"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var28_cur" select="."/>


                                                  <xsl:value-of select="ns0:ROW/ns0:DowodSprzedazy"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var29_cur" select="."/>


                                                  <xsl:value-of select="ns0:ROW/ns0:DataWystawienia"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var30_cur" select="."/>


                                                  <xsl:value-of select="ns0:ROW/ns0:DataSprzedazy"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var31_cur" select="."/>


                                                  <xsl:value-of select="number(ns0:ROW/ns0:K_10)"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var32_cur" select="."/>


                                                  <xsl:value-of select="number(ns0:ROW/ns0:K_13)"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var33_cur" select="."/>


                                                  <xsl:value-of select="number(ns0:ROW/ns0:K_15)"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var34_cur" select="."/>


                                                  <xsl:value-of select="number(ns0:ROW/ns0:K_16)"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var35_cur" select="."/>


                                                  <xsl:value-of select="number(ns0:ROW/ns0:K_17)"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var36_cur" select="."/>


                                                  <xsl:value-of select="number(ns0:ROW/ns0:K_18)"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var37_cur" select="."/>


                                                  <xsl:value-of select="number(ns0:ROW/ns0:K_19)"/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var38_cur" select="."/>


                                                  <xsl:value-of select="number(ns0:ROW/ns0:K_20)"/>





                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var39_cur" select="."/>



                                          <xsl:for-each select="ns0:FMPDSORESULT">

                                              <xsl:variable name="var40_cur" select="."/>







                          • 10. Re: XSL style - proffesional help needed

                            Ah! I see you added the new files to the original post.


                            your "for-each" is looping the entire document each time throughout the XSLT. You'll need a "loop" with the ROW element in the FMPDSORESULT grammar.

                            IF you only exported one record it would not matter, but you have more than one record (shown as ROW in the xml) and those must be handled correctly in the XSLT.


                            It's quite difficult for me to understand what you have and what you need. (I cannot read the XSD documentation.) But you may be close and perhaps my hints will help.



                            • 11. Re: XSL style - proffesional help needed

                              Hello there,

                              I create completly new xslt 1.0 script (sadly filemaker do not support xslt 2.0).


                              And I'm almost there

                              Link to xslt files: Almost_there.zip - Google Drive


                              The only thing I still can' solve it empty fields.


                              For example I have sales document (invoice) which as a record have all fields for purchase invoice type empty (for example purchase date - empty because it is a sales document).

                              So in XML file i have a lot of empty spots.


                              Is there any way to add something like "If" function into xslt? If (field is empty) - do not proceed etc.

                              • 12. Re: XSL style - proffesional help needed

                                Yes there is!

                                xsl:if test='..your element to test..'




                                However you should be getting an empty element without the "if"

                                &lt;element /&gt;

                                and your result xml is still valid.

                                • 13. Re: XSL style - proffesional help needed



                                  Can you show my one example how to implement it in my code?


                                  this is the part i don't want to proceed if it is sales invoice (field typZakupu is empty).


                                  <xsl:for-each select="ns0:FMPDSORESULT/ns0:ROW">

                                                  <xsl:variable name="var6_cur" select="."/>


                                                      <xsl:attribute name="typ" namespace="">

                                                          <xsl:value-of select="ns0:typZakupu"/>



                                                          <xsl:value-of select="ns0:LpZakupu"/>



                                                          <xsl:value-of select="ns0:NrDostawcy"/>



                                                          <xsl:value-of select="ns0:NazwaDostawcy"/>



                                                          <xsl:value-of select="ns0:AdresDostawcy"/>



                                                          <xsl:value-of select="ns0:DowodZakupu"/>



                                                          <xsl:value-of select="ns0:DataZakupu"/>



                                                          <xsl:value-of select="ns0:DataWplywu"/>



                                                          <xsl:value-of select="ns0:K_43"/>



                                                          <xsl:value-of select="ns0:K_44"/>



                                                          <xsl:value-of select="ns0:K_45"/>



                                                          <xsl:value-of select="ns0:K_46"/>



                                                          <xsl:value-of select="ns0:K_47"/>



                                                          <xsl:value-of select="ns0:K_48"/>



                                                          <xsl:value-of select="ns0:K_49"/>



                                                          <xsl:value-of select="ns0:K_50"/>





                                  &lt;element /&gt; < looks like java

                                  • 14. Re: XSL style - proffesional help needed

                                    I don't know what is 'sales invoice'. Follow the link I'd posted. There are some very good tutorials on XSLT. You are correct that FM only uses v1.0


                                    As an alternative, if you are more comfortable creating scripts and variables and temporary records in a temporary table, a calculated XML can be achieved for export.

                                    1 2 Previous Next