Jump to content
Andreas T.

BaseElements BE_ApplyXSLT returns blank with no output

Recommended Posts

Andreas T.    0
Posted (edited)

I need some help in determining if I am missing something crucial here or if there is a limitation or bug in the function BE_ApplyXSLT from the BaseElements plugin. I am using version 3.3.4 (which is the latest) on Mac OS X 10.11.6 using FileMaker 15 Adv. and 16 Adv.

I am unable to get any output from the transformation, nor any error.

According to the documentation, the command shall return either 0 when successful or an error. Link

In my testing it only returns blank, and gives no error even when no output file is generated. It should not return blank in cany case according to the docs. (I suspect there may be a documentation error and that it actually returns blank when there is no error.)
No error is found using Get(LastError). BE_GetLastError returns 0.

The function format is this:

BE_ApplyXSLT ( xmlPath ; xslt ; outputPath )

Here are the input parameters I have used:

BE_ApplyXSLT ( 
    "/var/folders/y6/1yf76qcs5y91h_w4j27hxp980000gp/T/S10.2/ABC_nota_108.xml" ; 
    BE_ReadTextFromFile ( "/var/folders/y6/1yf76qcs5y91h_w4j27hxp980000gp/T/S10.2/HTMLvisning/Stylesheet_Full.xsl" );
    "/var/folders/y6/1yf76qcs5y91h_w4j27hxp980000gp/T/S10.2/output.html"
)

I have verified that the files exist and that both the XML and XSLT are valid. All files are in UTF-8. I can transform the XML with this XSLT using other
methods without errors. I have also tried having the XSLT in a variable.

As I understand it, BaseElements uses the libxml2 engine. I have tried doing the transform from the command line directly and it works as it should:

xsltproc -o /var/folders/y6/1yf76qcs5y91h_w4j27hxp980000gp/T/S10.2/output.html /var/folders/y6/1yf76qcs5y91h_w4j27hxp980000gp/T/S10.2/HTMLvisning/Stylesheet_Full.xsl /var/folders/y6/1yf76qcs5y91h_w4j27hxp980000gp/T/S10.2/ABC_nota_108.xml

It also works fine using the XMLLib OSAX in AppleScript. Unfortunately, I need Windows support also so I would like to get the BaseElements function to work.

I hope somone can shed some light on what may be going on.

Edited by Andreas T.
Corrected OS version

Share this post


Link to post
Share on other sites
Andreas T.    0

Thank you, Comment for your confirmation of the documentation error and your suggestion.

I have already verified the paths with the BE_SelectFile function and they are correct.

Btw, using direct adressing with /private/var or the symlink /var makes no difference in any of the test scenarios I have tried. They both work, except in BE_ApplyXSLT where neither works. 

I think the function somehow chokes on my XML or XSLT, but then there should be an error. Besides, libxml2 transforms the file with no errors or warnings.

Share this post


Link to post
Share on other sites
comment    1,370
1 hour ago, Andreas T. said:

I think the function somehow chokes on my XML or XSLT

That should be easy to verify. Run a script like:

Set Variable [ $xmlPath; Value:"/path/to/input.xml" ]
Set Variable [ $xsltPath; Value:"/path/to/stylesheet.xsl" ] 
#
Set Field [ Table::XML; BE_ReadTextFromFile ( $xmlPath ) ]
Set Field [ Table::XSLT; BE_ReadTextFromFile ( $xsltPath ) ]
#
Set Field [ Table::Result; BE_ApplyXSLTInMemory ( Table::XML ; Table::XSLT ) ]

then you'll know exactly at which point/s it fails.

 

Share this post


Link to post
Share on other sites
Andreas T.    0

Thanks again.

I had already tried the BE_ApplyXSLTInMemory function in a similar fashion, but I did try again with your excact example and it fails in the same way with nothing returned. All paths are working and the files are being read into the fields.

The function silently fails.

I am going to try the function with some other XML and see if I can make out where it fails.

Share this post


Link to post
Share on other sites
Andreas T.    0

After spending close to two days on this annoying issue, I've reached the end of my rope and I'm giving up on these functions. They seem to fail to transform or error report many documents, even though I cannot see a pattern to it. 

Simple documents work fine, something a bit more complicated and they often fail silently.

Every other transformer I have found works including Oxygen, libxml2, AppleScript XMLLIB and this Java based (jaxp) online transformer: http://www.utilities-online.info/xsltransformation/#.WRWJHVLJLmE

As I cannot see a way to bug report this without paying $199, I'm out. I'll have to find an XML library I can use on Windows and use Applescript on the Mac.

Thanks for your input , Comment.

Share this post


Link to post
Share on other sites
comment    1,370

Could you post the XML and XSLT?

I would suspect a memory problem; see what happens if you reduce the size of the XML.

Share this post


Link to post
Share on other sites
Andreas T.    0

I can send you a PM with the files, if you are willing to give it a try. Would be useful to teste it on another machine, for sure.

The files are small, the XML is about 11K and the XSL with includes totals less than 100K. I have verified that all includes are included.

Share this post


Link to post
Share on other sites
comment    1,370
Posted (edited)
12 minutes ago, Andreas T. said:

and the XSL with includes

Ah! You did not mention includes until now. That is most likely the cause of the disruption. Note that the transformation does not use the XSLT file itself - it requires you to read its contents into memory. 

 

 

Edited by comment

Share this post


Link to post
Share on other sites
Andreas T.    0

Ah, you are probably right, but then it should at least have thrown exceptions about missing references. I have also tried with other XSL-files which have no dependencies and they also silently fail. I will try to combine thes files into one.

Share this post


Link to post
Share on other sites
comment    1,370
4 minutes ago, Andreas T. said:

I have also tried with other XSL-files which have no dependencies and they also silently fail.

Do you have an example of that?

Share this post


Link to post
Share on other sites
Andreas T.    0
8 minutes ago, comment said:

Do you have an example of that?

No.... Seems I made a mistake about that, there was an include in the one I was thinking about. Really confusing when the function doesn't report on such errors. That's what tripped me up. I have tested with so many scenarios that I'm not sure anymore what worked and what didn't. Have to assume then that it is missing dependencies that is the general cause. The function should error report on missing dependencies. All other processors do.

Going to start over after I combine the dependencies into the main XSL.

Thank you again so much, Comment for your time.

Share this post


Link to post
Share on other sites
comment    1,370

I conducted a small test of my own and I can confirm that including an external stylesheet causes a failure. That's hardly surprising given what I said earlier about the XSLT being applied from memory, even with the BE_ApplyXSLT() function. Strange choice on part of the plugin's author.

 

26 minutes ago, Andreas T. said:

The function should error report on missing dependencies.

Yeah, well, that seems to be a separate issue that muddies the waters. The function does not return any error codes - not even a 0 in case of success. 

 

 

  • Like 1

Share this post


Link to post
Share on other sites
Andreas T.    0

Thanks to you I finally managed to get the BE_ApplyXSLT function working after consolidating all external references into the main XSL. Obvious when you think about it it, but I somehow didn't catch that only the unparsed selected file was read in and got hung up in the fact that there seemed to be no errors.

IMO, the function needs some better error handling and the docs needs some error correction as well as maybe a note on this potential pitfall.

Thank you again. :beertime:

Share this post


Link to post
Share on other sites
jamesducker    2

I have exactly the same problem, but with really simple XML and XSL that has no external references.

I too have checked file paths thoroughly, and can transform successfully using xsltproc with exactly the desired result.

Anyone who wants to look at the files is welcome to :)

Share this post


Link to post
Share on other sites
comment    1,370
5 minutes ago, jamesducker said:

Anyone who wants to look at the files is welcome to

Well, what are you waiting for? Just attach them here (preferably reduced to the minimum required to show the problem).

Share this post


Link to post
Share on other sites
jamesducker    2

I'd rather not post them publicly… will send you a message :)

Just now, comment said:

Well, what are you waiting for? Just attach them here (preferably reduced to the minimum required to show the problem).

 

In my case I **am** able to use BE_ReadTextFromFile to read both files in from their paths, then apply the transformation successfully in memory, then use BE_WriteTextToFile to write it out again. So I have a workaround; the original problem remains interesting though.

Share this post


Link to post
Share on other sites
comment    1,370

I would much prefer you sanitize the files so that they can be discussed publicly. 

Share this post


Link to post
Share on other sites
comment    1,370

FWIW, I had no problem performing the transformation using the files you sent me in a PM, running BE 3.3.4 in FMP 16 on MacOS Sierra.

Were you able to perform a transformation using other files? 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Similar Content

    • By Johnn
      Hey,
      I'm fairly new to Filemaker and have a few question which I hope you can clarify.
      I have a Filemaker solution which I use for multiple customers. This solution exist of 2 files, a layout file and a database file. Everytime a new customer comes I copy the 2 files and clear the database so they can start fresh.  The problem i have with this method is that when I change something in one solution, I have to change it in all of them one by one. This takes way to many time.
      My question is : What is the best approach for this ?
      Is it possible to split up all "modules" to separate file? So I have a module (separate fm file) called Invoices, Contacts , Inventory etc... and set the database structure and  scripts in the separate file. 
      This way I have 1 main file which is connected to all the "modules" and all customers have their own main file connected to the "modules", this way if I change a script or database in the "module" it is changed with all customers.
      Is this even possible? or is there a better way to approach this?
       
      I hope you can give me some more information.
    • By halaeliya
      Hello,

      We are in the process of updating our FileMakerGo on the iPads from 13 to 16 but we are running into an issue with the sync. We are currently running MirrorSync 2.3 but will eventually upgrade to 3. Meanwhile, we need to get FMGO 15 or 16 work with our current MirrorSync.
      The sync error doens't always show, sometimes it syncs and sometimes it doesn't.
      Any ideas? 
      Thanks

    • By Richard Carlton
      FM Starting Point European Union and Coaching |FileMaker Pro 16 Videos |Online FileMaker 16 Training
      https://www.youtube.com/watch?v=gFnjRqtP4R0
      Most Recent Upload https://goo.gl/Dbn9fm
      Get up to speed with the FileMaker Pro 16 Video Training Course! 
      Top Rated Course by FileMaker Expert, Richard Carlton.  
      http://learningfilemaker.com/fmpro16.php
      Experience Richard's dynamic and exciting teaching format, while learning both basic, intermediate, and advanced FileMaker development skills. With 26 years of FileMaker experience and a long time speaker at FileMaker's Developer Conference, Richard will teach you all the ins and outs of building FileMaker Solutions.  
      The course is 50 hours of video content!
      Richard has been involved with the FileMaker platform since 1990 and has grown RCC into one of the largest top tier FileMaker consultancies worldwide. 
      Richard works closely with RCC's staff: a team of 28 FileMaker developers and supporting web designers. 
      He has offices in California, Nevada, and Texas.

      Richard has been a frequent speaker at the FileMaker Developers Conference on a variety of topics involving FileMaker for Startups and Entrepreneurs, and client-server integration.

      Richard is the Product Manager for FM Starting Point, the popular and most downloaded free FileMaker CRM Starter Solution.
      Looking for FM Starting Point free software download: http://www.fmstartingpoint.com
      Richard won 2015 Excellence Award from FileMaker Inc (Apple Inc) for outstanding video and product creation, leading to business development.

      RCC, Filemaker Videos, and LearningFileMaker.com are headquartered in Santa Clara, CA.
      http://www.rcconsulting.com/
      Please feel free to contact us at support@rcconsulting.com
      FileMaker Pro is simply a powerful software used to create custom apps that work seamlessly across iPad, iPhone, Windows, Mac, and the web
      Transform your business with the FileMaker Platform
      Free FileMaker Training Videos Channel https://www.youtube.com/user/FileMakerVideos
      50 Hour FileMaker Pro 16 Video Training Course-FileMaker 16 News-Online FileMaker 16 Training Videos
      https://www.youtube.com/watch?v=KpQqLLDcZ8I
      Playlist https://www.youtube.com/watch?v=KpQqLLDcZ8I&list=PLjTvUZtwtgBTMCfjM6LLwBAwGf_yXfvd_&index=13
      Top 10 New Features in FileMaker 16-FileMaker 16 News-FileMaker 16 Instructional Videos-FileMaker 16
      https://www.youtube.com/watch?v=urh8iHOCxkg
      Playlist https://www.youtube.com/watch?v=urh8iHOCxkg&t=130s&index=1&list=PLjTvUZtwtgBTMCfjM6LLwBAwGf_yXfvd_
      Sharing your Database with Other Devices and Users-FileMaker 16 News-FileMaker 16 Database Sharing
      https://www.youtube.com/watch?v=GF82vkYtCtA
      Playlist https://www.youtube.com/watch?v=GF82vkYtCtA&index=8&list=PLjTvUZtwtgBTMCfjM6LLwBAwGf_yXfvd_
      Introduction to FileMaker WebDirect 16-FileMaker 16 News-Online FileMaker 16 Training Videos
      https://www.youtube.com/watch?v=uaZKIpBjMAM
      Playlist https://www.youtube.com/watch?v=uaZKIpBjMAM&list=PLjTvUZtwtgBSVV1-4pFG4SHAhCIP3Yy-I&index=17&t=10s
      FileMaker Behavior Change-Go To Object-FileMaker 16 Video Training-FileMaker 16 News-FileMaker Video
      https://www.youtube.com/watch?v=MFwFjZem3AM
      Playlist https://www.youtube.com/watch?v=MFwFjZem3AM&index=15&list=PLjTvUZtwtgBQVDIUvoRkcvrMLi7sTZmj5
      A database management system (DBMS) is a computer software application that interacts with the user, other applications, and the database itself to capture and analyze data
       
      Official site provides the SDK, Developer's Guide, Reference, and Android Market for open source project
      http://learningfilemaker.com/FIAS.html
      Video introduction to iOS App Training https://www.youtube.com/watch?v=cVxQe_yAshw
      For Free, FileMaker videos check out ...http://www.filemakervideos.com
      Download the FileMaker Pro 16 & FileMaker GO 16 for mobile devices training videos at http://www.learningfilemaker.com
      Download FileMaker Go 16 video training at http://learningfilemaker.com/FMGO-16/fmgo16.php
      Download FileMaker 16 Full Video Training Bundle at http://learningfilemaker.com/subscription.php
      FileMaker Video Training Review-FileMaker 16 Video Course Review-FileMaker Pro 16 101 Course Review
      https://www.youtube.com/watch?v=mF6Uor0KmKo
      Playlist https://www.youtube.com/watch?v=mF6Uor0KmKo&list=PLjTvUZtwtgBT8tNHuzF6cOKC_37zCTQl6&index=18
      Learn how to use FileMaker to create an app with the FileMaker Training Series
      FileMaker Pro is a cross-platform relational database application from FileMaker Inc.
      Please Comment, Like & Share Our Videos.
      Feel Free to Embed any of Our Videos on Your Blog or Website.
      Follow Us on Your Favorite Social Media
      https://www.facebook.com/FileMakerVideos
      https://twitter.com/filemakervideos
      https://plus.google.com/+FileMakerVideos/videos
      #WhatisFileMaker16
      #FileMakerPro16Training
      #FileMakerPro16Videos
      https://www.youtube.com/watch?v=gFnjRqtP4R0&list=PLjTvUZtwtgBQVDIUvoRkcvrMLi7sTZmj5&index=26
      http://feeds.feedburner.com/FmStartingPointEuropeanUnionAndCoachingfilemakerPro16VideosonlineFilemaker16Training
    • By NewBoard
      I am designing a database for the inspection sheets used in our quality lab. Each of our parts has a different number of criteria that they need to be inspected for. This ranges anywhere from 5-15 dimensional requirements. I am wondering if there is anyway in FileMaker to display a varying number of both editable and uneditable fields. So for instance if somebody pulls an inspection sheet for a part with 6 different dimensional requirements, FileMaker will only show 6 uneditable fields describing the dimensions in question, and 6 editable fields for the user to type in their measurement. Then, if somebody pulls an inspection sheet with 10 dimensional requirements, it will display 10 instead.
      Thank you for any assistance you all can offer!
    • By blueworld4
      I am having some trouble getting my XSLT file to work.  I have followed many of the posts on here and have referenced
      https://www.w3schools.com/xml/xsl_intro.asp
      https://www.w3schools.com/xml/tryxslt.asp?xmlfile=cdcatalog&xsltfile=cdcatalog
      I seem to be able to get the examples to work and have had success with the example files for metars.cache.xml weather meter readings, but can't see why my own isn't working properly when it looks the same to me.  Any guidance would be gratefully received.  I am not new to Filemaker but this is my first attempt at importing and exporting data to/from our solution in XML which meets the UK Government standards.  My XSLT seems only to match fields but not actually import and records.  I have attempted referencing the template match to root with  <xsl:template match="/Message"> but this causes an "Invalid Document Structure" error in Filemaker, which doesn't seem to be a problem with the w3schools try xslt page.  I have reverted back to the format in the meters.xslt example file and now hope that somebody can help!!
      metars.cache.xml
      meters.xslt
      ILR-99999999-1617-20160229-144401-01.xml
      ILRLearningDeliveryImport.xslt
×

Important Information

By using this site, you agree to our Terms of Use.