Note by Apollia on Nov. 8, 2023: Please join my Patreon if you'd like to support me and my work!

My main personal website is now Apollia.org. I'm still not sure what to do with Astroblahhh.Com, so it's mostly staying as-is for now.





Puppy Linux Blog Archive - Jul 2016

Posts Below
7/9/2016 - How to add XML and XSLT 1.0 capabilities to Perl in Lucid Puppy Linux 5.2.8 version 004

    Hide/Show:


   ▲ Top  ▼ Bottom  △ TOC
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.




OK, back to the instructions.

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 believe the Perl module XML::LibXSLT only has XSLT 1.0 capabilities.

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.




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.

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:

http://distro.ibiblio.org/puppylinux/puppy-5.2.8/

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.




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.)

  1. XML::NamespaceSupport 1.11

  2. XML::SAX::Base 1.08

  3. XML::SAX 0.99

  4. XML::LibXML 2.0126

  5. XML::LibXSLT 1.93




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:

  1. Decompress the tarball.

  2. Open a terminal window and type these commands:

    perl Makefile.PL

    make

    make test

    make install

Or "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.

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:

int xsltMaxVars = 9999999;

That line is necessary because without it, the build will be halted with these errors:


But with that line, the build should succeed. So, now you can run these commands:

perl Makefile.PL

make

make test

make install


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.

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!


Perl XSLT Test Files.zip (3 KB)

All 3 files are also displayed below.



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

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.


Click this link to display the blog comment thread hosted at the Eryss.Com Forum:

   ▲ Top  ▼ Bottom  △ TOC


    Hide/Show:





Note by Apollia on Nov. 8, 2023: Please join my Patreon if you'd like to support me and my work!

My main personal website is now Apollia.org. I'm still not sure what to do with Astroblahhh.Com, so it's mostly staying as-is for now.