-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support XML Catalogs #28
Comments
For running XSLT, this extension supports the Providing a full implementation of the OASIS XML Catalogs specification is unfortunately beyond the scope of the editor at this point. Currently there is support for resolving package names instead? Package names are resolved using settings like:
Would something similar be adequate for
|
Not really, since this adds another place where one has to do housekeeping (since the other tools I use all support the catalog, I'd need to keep of all the stuff I produce on two sides). But I understand the concern. Time is limited and one can do just as much as one can do! :-)
|
Yes, you've found the effective entry point in `DocumentLinkProvider.provideDocumentLinks'. Perhaps the most important issue for VSCode programming language extensions is to keep the editing experience for the user responsive at all times. As you've found, my routines iterate over tokens, keeping tree information only as long as it's needed in the context. They are designed to get only 'just enough' data to perform their task. For example, XML well-formedness checking is not performed on imported/included files. The extension currently performs no caching as this can be quite hard to do reliably given the number of extensions providers in use and given that the order of requests from VSCode is unpredictable (the onDocumentChange event does not always fire before the Semantic Token request for example). To effectively work with XML Catalogs, there would probably need to be some caching to avoid parsing possibly multiple nested catalog files. So far, I've avoided using 3rd party libraries (apart from Saxon XSLT itself!). This is because it can be quite hard to learn how to use them most effectively, but also they have often been written with a very different set of priorities than required for a VSCode extension. One alternative approach would be, for a specific project, to convert XML Catalogs to JSON files - probably using XSLT. I took a similar approach for the XML Schema for XSLT 3.0 - converting it to a TS class. This is what provides the auto-completion information and will (eventually) allow full validation of the XSLT elements and attributes as they are being types. |
Oh yes! :-)
I am currently brainstorming a design proposal. As it seems, one would need two tables: the one, which contains all the XML Catalogs' complete mappings and one, that is only valid for the current document. The first one would need to be updated upon file-update of any of the catalogs. The second one would need to be notified of this update on one side and on the other side the editor would need to be notified of any changes, which the editor would need to poll, then and when. That sounds complex, but it may save time. Otherwise the editor would need to parse the whole catalogs each time it updates the document, which sounds like it would introduce a horrible latency.
Yes, that was the feeling I got when investigating your project. I completely understand. You may know of the Lemminx Language Server Protocol server for XML, which also has a VSCode client. They do full logical heavy lifting (in Java). The problem is, that they do not plan to support XSLT (nor XQuery) for the foreseeable future, maybe never, so they pointed to your project.
Yes, I see. I am not very well known in Javascript/Typescript/Node/VSCode so I would need to investigate more, but it seems to me, that node-xml2js and FontoXPath are pretty powerful (but also pretty heavy). Maybe node-xml2js would cover enough functionality on its own, maybe something much more simple could be used. I would only need to parse the catalog files and resolve the URIs therein, as I see it currently. I understand, if you don't want to go that road and keep things more stringent and lean.
Yes, this sounds like a possibility. One, then, could add a task/NPM script to manually update this information. Since we are in a manual producer environment, this is totally feasible. The user will always know, when (s)he has updated the catalog and can apply any needed steps.
Yes, I have seen it. I was already wondering, whether you created those long descriptions by hand... ;-). |
I'm just beginning to remind myself of how the existing code works for resolving file references. There are two main areas where file references are resolved:
The first thing I'll look at is a small amount of refactoring to decouple the resolving of file references more effectively. Currently I believe both methods use different function to resolve href attribute values so this needs to be fixed. Following this, I'm thinking I could add functionality so that hrefs can also use be resolved using a JavaScript map. We're then just left with the (most difficult) question of how this map is generated. To help me understand performance implications, in your dev environment, roughly how many XSLT files could be included in a set of XML Catalogs? At my workplace we have less than 50 XSLT files that may be imported/included. |
Sorry for being late, I missed the update.
Currently I have 129 mappings in my main catalog, of which 16 are stylesheets but this is growing as I create more XSLT function- and template-libraries. I also tend to include external character entities. The majority, however, is Namespace -> Schema mappings and XQuery module resolution, which play no role here.
Could you tell me more about this question? I assume, you may think about the mapping between key-name/value and what syntax to use? I would not know any way to introduce the EDIT: I just tested: const testO = {
'http://test.invalid/ns/cool1.0': 'result'
} and it was valid JS. |
I'm afraid it's been a while since I last looked at the issue - I'm quite busy on other features, but still keen to find a solution - even if it's a basic workaround to start with - using a similar lookup object to the code you show. |
Hello,
thanks for this great extension!
I have a line
in my stylesheet and an entry in my XML Catalog
which gets resolved via oXygen (SaxonPE/EE) but not in deltaxml.xslt-xpath (SaxonHE, though it seems Catalog support is available also in HE).
The text was updated successfully, but these errors were encountered: