XML to HTML help

This is just for a hobby, thanks for any suggestions or help.

Digitech makes guitar multi-effects pedals and they have a public user forum for sharing preset files to simulate a variety of guitar sounds. The particular products I am interested in are older discontinued models RPx400, RP300A and RP300, the RPx400 uses a USB computer interface to store and share preset files as XML data, the older RP300 and RP300A models have the same effects and user controls but lack the computer interface. By viewing the contents of the XML preset file from the newer unit, one can manually enter the preset into the older models. So in the interest of helping to share some guitar sounds among the small user community of these older model discontinued effects pedals, I was interested in creating a XML to HTML preset patch viewer for the RPx400 files so that RP300 and RP300A users could try them out. (I am not affiliated with Digitech at all).

An example preset file from the RPx400 is here:
http://www.digitech.com/soundcomm/patches/RPx400/Queen.r4p

Another line of GNX effects pedals has a preset viewer on the web, based on a different file format, but is a good example of how I would like to display the HTML to be more human-readable:
preset viewer example

So, I am a little familiar with perl and would lean towards using that, and I would want to set it up as a web page on my Tiger G3 with Personal Web Sharing which I have running with a DynDNS static alias to my dynamic IP.

Any pointers on how to set this up would be most appreciated.

PowerMacG3Desktop/SonnetG4/1GHz/768MB/DVR106D/ACARDRAID66/TangoUSBFW/ATI9200/OS9, Mac OS X (10.4.11), 2.16 GHz MacBook Core2Duo/3GB/Samsung204B/Airport Exreme Base Station

Posted on May 29, 2008 5:35 PM

Reply
5 replies

May 29, 2008 6:15 PM in response to Glen Doggett

Actually, what you want to use is XSL. If you look inside that file, it already has a stylesheet. Just download the Rpx400Preset.xsl using:

curl http://www.digitech.com/soundcomm/patches/RPx400/Rpx400Preset.xsl > Rpx400Preset.xsl


Then, run it through XSLT with:

xsltproc Rpx400Preset.xsl Queen.r4p > Queen.html


and open the resulting HTML file. If you want to change anything in the output, get a book on XSL and hack it up.

Have fun.

May 29, 2008 8:10 PM in response to etresoft

That's very helpful, the resulting HTML is just what I was looking for, I don't really need to even change it. Cool, thanks very much. I've noticed some of your other helpful posts here, I appreciate you taking the time.

I found that this works directly with the URL, an amazingly simple solution:
xsltproc http://www.digitech.com/soundcomm/patches/RPx400/Queen.r4p > Queen.html
I guess it's smart enough to look for the .xsl on the Digitech web server?

I'd like to encapsulate this command into an executable CGI script such that I can supply a URL for any of the .r4p files from the digitech web site passed in as an argument so that it returns the HTML dynamically, since the .r4p's are user contributed, it's not a static database.

I am kind of wondering if Digitech had this feature available on their web site at one time.

May 30, 2008 6:33 AM in response to Glen Doggett

I don't know if that will be possible due to the odd file extension "r4p". When you click on a link it just downloads the file. If it were .xml instead, it would just render the HTML in your browser.

You could rename the file yourself to xml and change the xsl stylesheet from just a file name to a complete URL.

You could also see if there is a way to get Safari to handle the r4p extension as an XML file. Try making a copy of the Safari application and hacking up its Info.plist file. Then try to view an r4p URL with your new Safari.

Or, you could just write a Perl script to grab the r4p via curl and feed it (via standard output) directly into xsltproc and print the result. A Perl script like that could be easily converted to CGI and should do what you want.

May 30, 2008 12:13 PM in response to etresoft

They actually have a .zip file download of all the existing contributed patches, and it seems like they must have updated the ROM of the device at some point, some older patches don't have the xsl tag in them, the newer ones do, about 2/3. But if I paste in the xsl tag in the older files then xsltrpoc renders the html fine, so it appears the basic xml format didn't change.

etresoft wrote:
Or, you could just write a Perl script to grab the r4p via curl and feed it (via standard output) directly into xsltproc and print the result. A Perl script like that could be easily converted to CGI and should do what you want.


Yes, exactly how I would like to set it up, since I'd like to share this patch viewer with others on my Personal Web Sharing server. I understand how to write the perl, but the part about setting up the CGI I'm not sure about, like what directory to put the perl script, does it matter? Is there a good reference book or on-line on the Mac-version of CGI how to set it up?

May 30, 2008 12:26 PM in response to Glen Doggett

Glen Doggett wrote:
Yes, exactly how I would like to set it up, since I'd like to share this patch viewer with others on my Personal Web Sharing server. I understand how to write the perl, but the part about setting up the CGI I'm not sure about,


Any Perl script can run as a CGI. Look for the CGI.pm module, which should always be installed. It is pretty simple. You get the Apache environment in the Perl %ENV hash when your script is run. If handling a POST request, the query comes in on standard input. The CGI.pm module can handle all of this very nicely.

like what directory to put the perl script, does it matter?


Yes. it has to go into your CGI-BIN directory, wherever your Apache configuration has that configured to be. Getting the cgi-bin directory straight is the hardest part of writing a CGI in Perl. This is the #1 reason why PHP is so popular. The default configuration for PHP allows PHP scripts to run in any directory. The default for Perl requires them to be in the cgi-bin directory. That's the only difference - the default setting.

Is there a good reference book or on-line on the Mac-version of CGI how to set it up?


Yes, but there are probably a few hundred. For this, there is nothing Mac about it. Just look for Apache CGI in Perl on UNIX. I have an ancient book on my desk titled "CGI Programming on the World Wide Web" circa 1996. It doesn't have CGI.pm and the screenshots are Netscape on MacOS 7. Still, it is just out of date, nothing in it is wrong per se.

It should be a 5-10 line Perl script, depending on how many comments you write.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

XML to HTML help

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.