Marsoner Stephan wrote:
> Hi,
> 
>  
> 
> I ran into severe problems trying to execute a stylesheet with 
> document-functions from within a process-command: the stylesheet was 
> executed, but document(file) never returned a value. (stylesheet works 
> fine when started outside of xxe!)
> 
>  
> 
> Tinkering with file locations I ran into this:
> 
>  
> 
> <cfg:transform stylesheet="c:/gtr/t3.xsl" file="c:/gtr/daten/eheg.xml" 
> to="c:/gtr/out.xml"/>
> 
>  
> 
> which resulted in following error: (see attached screenshot)
> 
> unknown protocol: c:
> 
> java.net.URL.<init>?
> 
>  
> 
> This is on a (german) XP box with java 1.5. (which already has caused 
> some ? now fixed ? problems with file-paths ?)
> 
>  
> 
> Copying the stylesheet to the local xxe-config directory and using
> 
>  
> 
> <cfg:transform stylesheet=" t3.xsl" file="c:/gtr/daten/eheg.xml" 
> to="c:/gtr/out.xml"/>

I'm sorry if the mix of URLs and filenames in cfg:transform is confusing.

The content model for the cfg:transform is

---
<transform
   stylesheet = anyURI
   cacheStylesheet = boolean : false
   file = Path
   to = Path
 >
---
(see 
http://www.xmlmind.com/xmleditor/_distrib/docs/commands/ch05s01s05.html)

And "c:/gtr/t3.xsl" is not an anyURI. (anyURI often means in Java 
applications such as XXE and Saxon: ``relative or absolute URL supported 
by Java'', that is, file://xxx, http://xxx, https://xxx, ftp://xxx, etc.)

You should rewrite this:

---
<cfg:transform stylesheet="c:/gtr/t3.xsl"
file="c:/gtr/daten/eheg.xml" to="c:/gtr/out.xml"/>
---

as:

---
<cfg:transform stylesheet="file:///c:/gtr/t3.xsl"
file="c:\gtr\daten\eheg.xml"  to="c:\gtr\out.xml"/>
---

(or
---
<cfg:transform stylesheet="file:/c:/gtr/t3.xsl"
file="c:\gtr\daten\eheg.xml"  to="c:\gtr\out.xml"/>
---)

c:/gtr/daten/eheg.xml, i.e. filenames using '/' as a separator, happens 
to work on Windows but I would not recommend using this under-advertised 
feature of the OS.



> ..works, but all  document(filename) ? expressions which have absolute 
> filenames (i.e. c:/gtr/daten/something ?) don?t deliver anything ? 
> relative filenames work!

In the document() XSLT function, first argument is treated as a URI 
reference. Therefore, you cannot use absolute filenames here. See 
http://www.w3.org/TR/xslt#document

Relative filenames work because they are often identical to the 
corresponding relative URLs (on Unix and when you use '/' on Windows).


Reply via email to