[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)) ?

Subject: Re: How to use saxon:node-set(document($f)) ?
From: Warren Hedley <w.hedley@xxxxxxxxxxxxxx>
Date: Wed, 03 May 2000 11:55:48 -0400
saxon setting start node
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

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.