[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
how to use saxon
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.