How to use saxon:node-set(document($f)) ?

Subject: How to use saxon:node-set(document($f)) ?
From: Warren Hedley <w.hedley@xxxxxxxxxxxxxx>
Date: Mon, 01 May 2000 13:44:09 -0400

I'm trying to write a stylesheet that produces some
nice error messages, instead of parser error messages,
when a configuration file cannot be loaded. Previously
I would load a configuration file (name specified on
the command line) with this:

<xsl:param name="CONFIG_FILE" select="'???'" />
<xsl:variable name="config" select="document($CONFIG_FILE)" />

This results in a fatal error if CONFIG_FILE is not
specified, with a (perhaps) unsightly error message.
Unfortunately if I put some "if"s around the document()
function, I get an RTF instead of a nodeset, but in
this case I'm prepared to use extension functions
like saxon:node-set().

So I tried this (fluff omitted) :

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl=""; version="1.0"

<xsl:param name="CONFIG_FILE" select="'???'" />

<xsl:variable name="config">
  <xsl:if test="$CONFIG_FILE != '???' and
    <xsl:value-of select="saxon:node-set(document($CONFIG_FILE))" />

<xsl:template match="/">
<xsl:message terminate="yes">
  <xsl:text>$config = </xsl:text>
  <xsl:copy-of select="$config" />

----- END XSL

saxon:node-set(document($CONFIG_FILE)), and various simple
variations on that theme, appear to produce empty node-sets,
(yes it is called).

What am I doing wrong?

Thanks in advance.

Warren Hedley
Department of Engineering Science
Auckland University
New Zealand

 XSL-List info and archive:

Current Thread