How to add XML and XSLT 1.0 capabilities to Perl in Lucid Puppy Linux 5.2.8 version 004 |
Saturday, July 9th, 2016 19:21:33 GMT |
By default, I don't know if Lucid Puppy Linux 5.2.8 version 004's copy of Perl already includes modules for dealing with XML and XSLT. But, I don't think it had the ones I wanted to use, so I figured out how to install them.
And I avoided using the "cpan" automated installer for Perl modules because I was using a computer I keep disconnected from the internet.
And also because I dislike package managers or any other software which is excessively dependent on internet access. Given these poverty statistics, I think it's better not to just assume the internet is constantly available to everyone who needs it. The less everyone's computing is dependent on the internet, the better, in my opinion.
There was only one tricky part. I'm dubious about whether I handled that correctly, but, I'll explain that below when we reach that step.
I still haven't done very much with XSLT 2.0 (nor even XSLT 1.0), or Saxon-CE, but I'm guessing Saxon-CE is probably one of the easiest ways to get started doing something with XSLT 2.0, since Saxon-CE is written in JavaScript and runs in a web browser.
Many web browsers already have XSLT 1.0 capabilities built in.
My page of Some Puppy Linux Basics explains more about DevX files, and if you need the DevX for Lucid Puppy 5.2.8, it's available at this link:
If you're using a different version of Puppy than Lucid Puppy 5.2.8, that DevX probably won't work, so you should instead download the DevX released for your Puppy.
Also, if you're not using Lucid Puppy 5.2.8, please bear in mind that the instructions in this blog post might not all apply or work for you, since different Puppy Linux distros, and probably even different versions of the same Puppy distro, can differ quite substantially from each other.
And here's how to load SFS files.
make
make test
make install
Or
Decompress the XML::LibXSLT tarball.
Then, open the file "LibXSLT.xs" in a text editor, and add this line below the comment section at the top:
That line is necessary because without it, the build will be halted with these errors:
make
make test
make install
Here's a zip file containing all 3, which aren't by me, but were slightly modified by me. I changed hardly anything in the Perl script, and all I did with the XSLT stylesheet was add a comment with a link to where I found it.
And the VUE: Visual Understanding Environment concept map file was saved by me, but its source code was automatically generated by VUE. And I had to slightly edit it because of the comments at the top which Perl disliked.
Thanks to all the authors of this code!
All 3 files are also displayed below.
If that succeeds, the output will be in a newly-created HTML file named test-xslt-perl-script-output.html.
Hopefully soon I'll learn XSLT well enough to figure out how to extract the node text, which is usually the most interesting part of a VUE: Visual Understanding Environment concept map.
OK, back to the instructions.
I believe the Perl module XML::LibXSLT only has XSLT 1.0 capabilities.
There seem to be some parts of the below Perl modules which are written in C, so, I believe to install them, it's necessary to use the DevX file of development tools for your Puppy Linux.
Next, get the tarballs of the following Perl modules. (The version numbers are just what I used - I don't know if these specific versions are actually required for all these things to work together.)
It's necessary to install each of those modules in the order given above. Do the following 2 steps for the first 4 modules above:
perl Makefile.PL
"new2dir make install"
(without quotes) if you'd like to make a pet file or SFS file.
With one Perl module, there might be some annoying warning about "6.55_02" not being numeric, but since that warning didn't stop the build, I ignored it.
Now, the tricky part. I don't know if my trick really solved the problem, and I don't even know whether or not it might have created other problems. But, at least it made it possible for me to successfully run "make" on the XML::LibXSLT module.
int xsltMaxVars = 9999999;
But with that line, the build should succeed. So, now you can run these commands:
perl Makefile.PL
Or "new2dir make install"
(without quotes) if you'd like to make a pet file or SFS file.
Now, to see if the modules are working, you'll need three things - a Perl script, an XML file, and an XSLT file.
A Perl script which is a slightly modified version of this code from StackOverflow:
An XSLT stylesheet from this post on StackOverflow:
A saved VUE: Visual Understanding Environment concept map file. I had to move the comments formerly at the top (which tell you not to remove them) into a CDATA section near the top, because Perl was complaining about them.
All three files should be in the same folder when you run this command:
perl test-xslt.pl