Subject: How to use saxon:node-set(document($f)) ? From: Warren Hedley <w.hedley@xxxxxxxxxxxxxx> Date: Mon, 01 May 2000 13:44:09 -0400 |
Hi 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) : ----- START XSL <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:saxon="http://icl.com/saxon" xmlns:file="java.io.File" extension-element-prefixes="saxon" exclude-result-prefixes="saxon"> <xsl:param name="CONFIG_FILE" select="'???'" /> <xsl:variable name="config"> <xsl:if test="$CONFIG_FILE != '???' and file:exists(file:new($CONFIG_FILE))"> <xsl:value-of select="saxon:node-set(document($CONFIG_FILE))" /> </xsl:if> </xsl:variable> <xsl:template match="/"> <xsl:message terminate="yes"> <xsl:text>$config = </xsl:text> <xsl:copy-of select="$config" /> </xsl:message> </xsl:template> </xsl:stylesheet> ----- 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: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Parser setup in Xalan?, yqin | Thread | Re: How to use saxon:node-set(docum, Warren Hedley |
RE: Does XSL support an eval?, Selva, Francis | Date | ANN: Resin 1.1.1, Scott Ferguson |
Month |