[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to use saxon:node-set(document($f)) ?
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|