After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 604905 - Add possibility to parse import before check if it's a valid URI
Add possibility to parse import before check if it's a valid URI
Status: RESOLVED WONTFIX
Product: libxslt
Classification: Platform
Component: general
unspecified
Other All
: Normal enhancement
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2009-12-18 12:57 UTC by Ulrich VANDENHEKKE
Modified: 2010-01-20 11:45 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ulrich VANDENHEKKE 2009-12-18 12:57:06 UTC
In file import.c, i would like a entry point to modify URI before called of xmlBuildURI.

Actually i use :
		defaultEntityLoader = xmlGetExternalEntityLoader();
		xmlSetExternalEntityLoader(myExternalEntityLoader);

to modify the URI.

The problem is now my URI (it's not my choice), has the form <xsl:import href="{XXX_XXX}/document.xsl"/>.
This document is used with the Oracle parser and {XXX_XXX} is replaced by the good path.

I would like parse this stylesheet with my own app, but i have the error (because of { and }): 
xsl:import : invalid URI reference {XXX_XXX}/document.xsl

The method myExternalEntityLoader is never called. 

How can i change the value of {XXX_XXX} in import and import of import ? I can't remove or replace { and }.

Thanks in advance
Comment 1 Daniel Veillard 2009-12-18 19:01:39 UTC
Well you're asking an XSLt parser to parse something which will become XSLT only
after some preprocessing, that's likely to fail. I'm not tempted to make more
extension for something like this.

You can try to register your own Input handler instead, this may work

http://xmlsoft.org/html/libxml-xmlIO.html#xmlRegisterInputCallbacks

Daniel
Comment 2 Ulrich VANDENHEKKE 2009-12-22 07:56:43 UTC
Thanks for the link. 
Too bad this isn't as convenient that xmlSetExternalEntityLoader (because i must reparse the xml to find import, and replace it).

In general, it could be great if i can modify the document structure (XML) before it was parsing by the methode xsltParseStylesheetFile for the file (for this i can use [1]) and it's import (i don't have solution).

[1] xmlDocPtr xslDoc = xmlParseMemory( data, data.size() );
    d->m_stylesheet = xsltParseStylesheetDoc( xslDoc );
Comment 3 Ulrich VANDENHEKKE 2010-01-20 11:45:07 UTC
I use xmlRegisterInputCallbacks to pre-parse the file, and that's work as i want, but with a double parsing.

Thanks