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

Re: document('') returning null in certain environment

Subject: Re: document('') returning null in certain environments?
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Sun, 31 Oct 2010 00:18:50 +0100
Re:  document('') returning null in certain environment
There's no such thing as "null" in the XPath data model, but I suspect you mean that document('') is returning an empty node-set. The most likely explanation for that is that the base URI of the stylesheet is unknown. The W3C specs and RFCs don't like to admit that you can have a document whose base URI is unknown, but it can happen very easily in practice - for example the base URI of a DOM is always unknown, and the base URI of a Java StreamSource is unknown unless you explicitly set its SystemID property.

Michael Kay
Saxonica

On 31/10/2010 00:06, J Ferry wrote:
Let me start with the high level description of what I'm trying to
accomplish...

But first, I've got a limitation with the system I'm working with that
I can only use a single stylesheet for this particular document.

The document was originally developed as separate stylesheets, a
couple of which are the barcode stylesheets from RenderX.

I naively mashed them together into a single stylesheet and this seems
to work fine in my development environment (I was using OxygenXML now
using Ant) but it does not work when loaded into the target system (a
Java app running on SunOne/Tomcat). I'm not very good at debugging
stylesheets yet (someone needs to build a tool for that...) but I
think I've tracked the problem to the use of document(''). It appears
that the use of document('') in the target system (Tomcat/SunOne)
returns null, which is supposed to be used to select a value from a
character lookup table like this...

value =<xsl:value-of
select="document('')//my:char2value/entry[@char=$char and
@subset=$subset]/text()"/>

The lookup table looks like this...

<my:char2value>
     <entry char="&#x0020;" subset="A">0</entry>
     <entry char="&#x0020;" subset="B">0</entry>
     <entry char="00" subset="C">0</entry>
     <entry char="!" subset="A">1</entry>
     <entry char="!" subset="B">1</entry>
          :
          :
          :
</my:char2value>

Is there something I need to do to my runtime (different parser or
something) or is there a way to fix it in my stylesheet? I could put
together a more complete example if necessary but you'd still need the
runtime...

Regards,
Jeremy

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.