The XSLProcessor.setParam(uri, name, value) allows you so set the value of a top-level stylesheet parameter.
The uri parameter is the namespace URI of the paramater name, which by the XSLT 1.0 specification is a qualified name.
That means that you can have:
<xsl:stylesheet xmlns:foo="urn:foo" xmlns:bar="http://bar.com/params" ...>
<xsl:param name="foo:param1"/>
<xsl:param name="bar:param2"/>
<xsl:param name="param3"/>
so the parameter names can be namespace-qualified, where the namespace prefix is a shortcut syntax for referring to the fully-specified namespace URI.
So, to set values for all three of these parameters above, you would do:
xslProc.setParam("urn:foo","param1","'val1'");
xslProc.setParam("http://bar.com/params","param2","'val2'");
xslProc.setParam("","param3","'val3'");
The parameter value is expected to be a valid XPath expression (note that string literal values would therefore have to be explicitly quoted)
[Gleaned from mailing list email from Steve Muench and documentation]
Paul Oracle, XSLT Processing
A new feature for Oracle 10g [1] for PL/SQL is “Regular Expressions.”:http://otn.orcle.com/oramag/oracle/03-sep/o53sql.html As you know regular expressions are very powerful, almost too powerful, and I know a bit about them, but can’t use them at all. Except now it will be my job to know it, because lots of PL/SQL programmers are going to be asking how to use it, and they’ll be finding lots of interesting bugs in the way obscure expressions don’t do it quite like Perl does it.
We’ve got some new functions that you can stick in your SQL statements such as
SELECT ename FROM emp WHERE REGEXP_LIKE(empno, ‘[0-9]{3}-[0-9]{4,4}’);
btw, with XML DB (9iR2) you can use xpath expressions in your where statements too
select P.PODOCUMENT
from PURCHASEORDER P
where P.PODOCUMENT.extract(’/PurchaseOrder/Reference/text()’).getStringVal() =
‘BLAKE-2001062514034298PDT’;
A neat trick is that if you use a regular expression a lot you can use a functional index to improve the performance.
[1] What’s 10g I here you ask? Well, it is another marketing term for the next version of the database. We had version 8, and then there was the dot com boom and 8i was invented. This actually deserved an x.1 version increase. But then we had 9i, which was something like 8.2, and now 10g could 8.3. Only 10 sells better than 8.3, and a different letter, an interestingly different letter to i, sells better again. Apparently. Anyway, the G stands for grid, and it is all about Grid computing which is the Next Big Thing. Apparently.
Paul Oracle
??Steven Feuerstein?? starts a series of articles on a PL/SQL code analysis Utility. Whilst the actual code might be of the greatest use, I am greatly interested in the process he is following.
In the first article he finds out whether he can gather in enough information to build the application he wants to. Finding one such package (DBMS_DESCRIBE) is very difficult to work with, he builds a wrapper round it to make it easy to use.
As someone who is being _forced_ to learn PL/SQL at the moment (I never did care for its syntax; it seemed alien) it is useful to see.
Paul Oracle
Recent Trackback template using just MovableType and the MTSQL plugin. (Did I tell you how much I liked the MTSQL plugin? Oh, I did, didn’t I.)
<ul>
<MTSQLPings query="select p.tbping_id
from mt_entry e, mt_trackback t, mt_tbping p
where e.entry_id = t.trackback_entry_id
and t.trackback_id = p.tbping_tb_id order by p.tbping_created_on limit 5">
<MTSQLEntries query="select DISTINCT e.entry_id
from mt_entry e, mt_trackback t, mt_tbping p
where e.entry_id = t.trackback_entry_id
and t.trackback_id = p.tbping_tb_id
and p.tbping_id = [MTPingID]">
<li><a href="<MTPingURL>"><MTPingTitle></a>
on <a href="<MTEntryPermalink>"><MTEntryTitle></a>
</li>
</MTSQLEntries>
</MTSQLPings>
</ul>
Change the value after limit to however many trackbacks you want. In theory, you can use any MTEntries or MTPings tags you want in there
So, for inclusion with SimpleComments, this is my template.
<h4>Recent Comments</h4>
<ul class="recentcomments">
<MTSimpleComments lastn="15" sort_order="descend">
<MTSimpleCommentIfComment>
<li><$MTCommentAuthorLink show_email="0"$>
on <a href="<MTCommentEntry>
<$MTEntryPermalink$>
</MTCommentEntry>#comment<$MTCommentID$>"><MTCommentEntry><$MTEntryTitle$></MTCommentEntry>
</a></li>
</MTSimpleCommentIfComment>
<MTSimpleCommentIfTrackback>
<MTSQLEntries query="select DISTINCT e.entry_id
from mt_entry e, mt_trackback t, mt_tbping p
where e.entry_id = t.trackback_entry_id
and t.trackback_id = p.tbping_tb_id
and p.tbping_id = [MTPingID]">
<li>[Trackback] <a href="<MTPingURL>"><MTPingTitle></a>
on <a href="<MTEntryPermalink>"><MTEntryTitle></a>
</li>
</MTSQLEntries>
</MTSimpleCommentIfTrackback>
</MTSimpleComments>
</ul>
Paul MovableType, mySql
I’ve switched the backend database from the built in Berkeley DB to mySQL and the conversion process and subsequent MT upgrade problem has taught me a little bit about what is a new database for me.
I come from a background of using Oracle, which is a heavy-weight database for serious use. I doubt I’ll ever need the power of Oracle for any personal project I do, it I will be interested to see how mySQL copes under strain given its more light-weight standing in the database world.
First thing that threw me was the differences in naming conventions. An Oracle database is the binary files existing in a specific Oracle Home. You can have multiple instances running per database, they all run in the same Oracle Home (you can have different versions of Oracle running in different Oracle Homes). Inside each instance, you have a schema for each user, containing tables, views and other RDBMS stuff. So, a CREATE DATABASE command will create a new instance that runs completely separately and has its own set of users, i.e. there will be a SYS and SYSTEM in each instance.
mySQL’s CREATE DATABASE command really creates the equivalent of a new schema. There is now new ROOT user for this database, and the ROOT user does all the granting of permissions for the user of the database (you can have multiple users for this database still; I’m not at the stage yet to know whether you can have a user with the power of ROOT just for this database). This hit me when I had the permission problem above. I tried to grant myself the correct alter permission, but it seemed only ROOT could do this.
I like the way mysqldump works, a plain and simple way of doing a backup. It actually creates a series of SQL scripts much like the EXP binary in Oracle, but this script that is created is text rather than a binary dump.
I’m looking forward to further playing with the database and producing some interesting things with mySQL and Python. One notes that Shelley is able to do a lot of interesting custom stuff over the top of MT using PHP. This leads me down an interesting thought path. Is it always better to have a mysql like database (e.g. Postgres) as the backend? Or does the advantage of a built-in database like BerkeleyDB outweigh the features you can create? Non extra install required. This is something I discussed with Stuart whilst he was throwing all his Vellum ideas at me. He preferred the idea that you could just install Vellum and you were ready to go, whilst I (being a DBA) wanted the database.
Paul mySql
I did it the hard, long way, but I’ve switched to mySQL now. Exported from the old system, re-ran mt-load.cgi with the new database settings in place, and imported. Already I felt the power; instead of having to go through many web pages telling MT which template file to match to which template, I did it in a few update statements in mySQL instead. I’m going to enjoy this.
Paul MovableType, mySql
Recent Comments