Subject: Re: How to use saxon:node-set(document($f)) ? From: Warren Hedley <w.hedley@xxxxxxxxxxxxxx> Date: Wed, 03 May 2000 12:59:33 -0400 |
Apologies if this gets posted twice - my network connection died about 1 second after I hit "send", and there's no sign of it after an hour. Here it is again. Kay Michael wrote: > > I don't think there are any circumstances in which saxon:node-set() should > produce an empty node-set, so I'd be grateful if you could supply a complete > stylesheet that demonstrates the problem. OK - here's a simple demo. --- nodetest.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:output method="xml" /> <xsl:param name="CONFIG_FILE" select="'???'" /> <xsl:variable name="config_doc" select="document($CONFIG_FILE)" /> <xsl:variable name="config_ns"> <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="/"> --- start $config_doc --- <xsl:copy-of select="$config_doc" /> --- end $config_doc --- --- start $config_ns --- <xsl:copy-of select="$config_ns" /> --- end $config_ns --- </xsl:template> </xsl:stylesheet> --- nodetest.xsl --- --- input_document.xml --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE input_document> <source_document /> --- input_document.xml --- --- configuration.xml --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration> <configuration> <directory_alias alias="HOME" directory="/home/hedley" /> </configuration> --- configuration.xml --- Using Saxon 5.3 : java com.icl.saxon.StyleSheet input_document.xml \ nodetest.xsl CONFIG_FILE=configuration.xml produces <?xml version="1.0" encoding="utf-8" ?> --- start $config_doc --- <configuration> <directory_alias alias="HOME" directory="/home/hedley"/> </configuration> --- end $config_doc --- --- start $config_ns --- --- end $config_ns --- Incidentally, I originally had the output for each variable inside a <xsl:message> element and was getting some unusual results : <xsl:message> <xsl:text>$config_doc = `</xsl:text> <xsl:copy-of select="$config_doc" /> <xsl:text>'</xsl:text> </xsl:message> gives $config_doc = `<configuration ><directory_alias alias="HOME" directory="/home/hedley" ' which isn't well-formed. Section 13 says something about "instantiating the content to create an XML fragment" -I'm not sure exactly what this means, but I wouldn't have expected the behaviour above. Any help much appreciated. -- 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 -> |
---|---|---|
Re: How to use saxon:node-set(docum, Warren Hedley | Thread | RE: How to use saxon:node-set(docum, Kay Michael |
Re: The XSL-List Digest V3 #2, Peter Bryant | Date | Re: Java Servlets, Josef Vosyka |
Month |