XSLT include resolve - base-uri

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

XSLT include resolve - base-uri

cmarchand

 

 

Hello,

 

I have an XSL which includes another one.

I expect the URIResolver being called with (included-uri, mainXsl-baseUri), but base is always an empty string.

 

XSL template is loaded with

xsltCompiler.compile(new StreamSource(input, new File(templateFilePath).toURI().toURL().toExternalForm()));

 

Do I miss something ?

 

Thanks in advance,

Christophe


------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: XSLT include resolve - base-uri

Michael Kay
Could you please provide runnable code so we can reproduce the problem (or see what you have done wrong).

Thank you.

Michael Kay
Saxonica

 

On 16 Jun 2015, at 11:00, [hidden email] wrote:

 
 

Hello,

 

I have an XSL which includes another one.

I expect the URIResolver being called with (included-uri, mainXsl-baseUri), but base is always an empty string.

 

XSL template is loaded with

xsltCompiler.compile(new StreamSource(input, new File(templateFilePath).toURI().toURL().toExternalForm()));

 

Do I miss something ?

 

Thanks in advance,

Christophe

------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: XSLT include resolve - base-uri

cmarchand
Solved.
I though StreamSource(FileInputStream) used the file reference to set the system id. But there is only a StreamSource(InputStream), which can not use a file reference...

Thanks a lot,
Christophe

Le 16/06/2015 19:59, Michael Kay a écrit :
Could you please provide runnable code so we can reproduce the problem (or see what you have done wrong).

Thank you.

Michael Kay
Saxonica

 

On 16 Jun 2015, at 11:00, [hidden email] wrote:

 
 

Hello,

 

I have an XSL which includes another one.

I expect the URIResolver being called with (included-uri, mainXsl-baseUri), but base is always an empty string.

 

XSL template is loaded with

xsltCompiler.compile(new StreamSource(input, new File(templateFilePath).toURI().toURL().toExternalForm()));

 

Do I miss something ?

 

Thanks in advance,

Christophe

------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help



------------------------------------------------------------------------------


_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 


------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: XSLT include resolve - base-uri

Michael Kay
If you give StreamSource a File or a URI, then Saxon (and the XML parser) will know the base URI.

If you give it an InputStream (including a FileInputStream) or a Writer, then Saxon and the XML parser have no information about where the stream comes from, which means the base URI is unknown. But you can supply this information in the second argument, or by calling setSystemId().

Similar considerations apply when you supply a SAXSource.

Michael Kay
Saxonica


On 16 Jun 2015, at 23:00, Christophe Marchand <[hidden email]> wrote:

Solved.
I though StreamSource(FileInputStream) used the file reference to set the system id. But there is only a StreamSource(InputStream), which can not use a file reference...

Thanks a lot,
Christophe

Le 16/06/2015 19:59, Michael Kay a écrit :
Could you please provide runnable code so we can reproduce the problem (or see what you have done wrong).

Thank you.

Michael Kay
Saxonica

 

On 16 Jun 2015, at 11:00, [hidden email] wrote:

 
 

Hello,

 

I have an XSL which includes another one.

I expect the URIResolver being called with (included-uri, mainXsl-baseUri), but base is always an empty string.

 

XSL template is loaded with

xsltCompiler.compile(new StreamSource(input, new File(templateFilePath).toURI().toURL().toExternalForm()));

 

Do I miss something ?

 

Thanks in advance,

Christophe

------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help



------------------------------------------------------------------------------


_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 

------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: XSLT include resolve - base-uri

cmarchand

 

 

Yes thanks, but it is a long time since I've used thoses classes in Java, and Javadoc is not as precise as it should on this !

Thanks again,

Christophe

 

Le 2015-06-17 00:58, Michael Kay a écrit :

If you give StreamSource a File or a URI, then Saxon (and the XML parser) will know the base URI.
 
If you give it an InputStream (including a FileInputStream) or a Writer, then Saxon and the XML parser have no information about where the stream comes from, which means the base URI is unknown. But you can supply this information in the second argument, or by calling setSystemId().
 
Similar considerations apply when you supply a SAXSource.
 
Michael Kay
Saxonica
 

On 16 Jun 2015, at 23:00, Christophe Marchand <[hidden email]> wrote:
Solved.
I though StreamSource(FileInputStream) used the file reference to set the system id. But there is only a StreamSource(InputStream), which can not use a file reference...

Thanks a lot,
Christophe

Le 16/06/2015 19:59, Michael Kay a écrit :
Could you please provide runnable code so we can reproduce the problem (or see what you have done wrong).
 
Thank you.
 
Michael Kay
Saxonica
 
 

On 16 Jun 2015, at 11:00, [hidden email] wrote:
 
 

Hello,

 

I have an XSL which includes another one.

I expect the URIResolver being called with (included-uri, mainXsl-baseUri), but base is always an empty string.

 

XSL template is loaded with

xsltCompiler.compile(new StreamSource(input, new File(templateFilePath).toURI().toURL().toExternalForm()));

 

Do I miss something ?

 

Thanks in advance,

Christophe

------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help



------------------------------------------------------------------------------


_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help

------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: XSLT include resolve - base-uri

Michael Kay

On 17 Jun 2015, at 07:18, [hidden email] wrote:

 
 

Yes thanks, but it is a long time since I've used thoses classes in Java, and Javadoc is not as precise as it should on this !



Yes, I get more and more frustrated with JAXP - both its design and its documentation - as the years pass by.

Michael Kay
Saxonica


------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: XSLT include resolve - base-uri

Andrew Welch

JAXP causes no end of problems... really hard problems to diagnose and solve, and yet it's main benefit of enabling the swapping out of the underlying impl is rarely if ever used, and not exactly a big code change.


On Wed, 17 Jun 2015 09:12 Michael Kay <[hidden email]> wrote:

On 17 Jun 2015, at 07:18, [hidden email] wrote:

 
 

Yes thanks, but it is a long time since I've used thoses classes in Java, and Javadoc is not as precise as it should on this !



Yes, I get more and more frustrated with JAXP - both its design and its documentation - as the years pass by.

Michael Kay
Saxonica

------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@...

https://lists.sourceforge.net/lists/listinfo/saxon-help

------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help