C.3. Final notes

The above stylesheet was tested using James Clark's XT XSLT processor. I also wrote a C++ implementation. Running both on my computer yielded the results in Table C-1.

Table C-1. Comparing processing speed between between XSLT and C++ for solving N-Queens
Number of Queens Number of Solutions Time to run in XSLT Time to run in C++
4 2 1.0 second 0.065 seconds
6 4 1.5 second 0.065 seconds
8 92 8.5 seconds 0.065 seconds
10 724 3.0 minutes 0.180 seconds

XT is a pretty fast XSLT processor. It is just not optimized for the kind of processing this stylesheet performs. Not only that, while the stylesheet does print all the solutions to the N-Queens problem, it does not print a serial number by each. It turns out that doing so is a non-trivial ...

Get XSLT and XPATH: A Guide to XML Transformations now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.