xsl-list
[Top] [All Lists]

[xsl] Global variable reads in the input XML document using the document() function ... sometimes it works, sometimes it doesn't

2012-10-27 08:11:44
Hi Folks,

I have an XSLT program which has a global variable that uses the document() 
function to read in the XML document that the program was invoked with:

------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
                           version="2.0">

    <xsl:variable name="file" select="document(.)"/>

    <xsl:template match="/">
        ...
    </xsl:template> 

</xsl:stylesheet>
------------------------------------------------------

On some input XML documents that XSLT program works, and on others I get a 
horrific error message such as this:

FODC0002: Exception thrown by URIResolver: Invalid relative URI
{\n\t\t\t\tThis%20is%20an%20ann...}: Illegal character in path at index 0:

It appears that the problem is with this statement:

    <xsl:variable name="file" select="document(.)"/>

Sometimes the document() function finds the input XML file and sometimes it 
doesn't.

Why?

I solved the problem by passing into the XSLT program the filename of the input 
XML file and then invoking document() with that filename. But I'd like to 
understand why the other approach doesn't work.

/Roger

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


<Prev in Thread] Current Thread [Next in Thread>