This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 195028 - [xslt] Add Content Assist for XSLT.
Summary: [xslt] Add Content Assist for XSLT.
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xsl (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.1   Edit
Assignee: David Carver CLA
QA Contact: David Williams CLA
URL:
Whiteboard: M1
Keywords:
: 213854 (view as bug list)
Depends on: 157254
Blocks: 208681
  Show dependency tree
 
Reported: 2007-06-30 14:11 EDT by David Carver CLA
Modified: 2009-04-30 14:25 EDT (History)
3 users (show)

See Also:


Attachments
Corrects XSLT 1.0 xsd. (15.98 KB, text/xml)
2007-12-27 21:44 EST, David Carver CLA
no flags Details
Modified version of XSLT 2.0 schema to implement XSLT 1.0 spec (30.70 KB, application/xml)
2007-12-28 00:31 EST, David Carver CLA
no flags Details
Updated XSLT 1.0 xsd which contains documentation for attributes and elements. (63.91 KB, application/xml)
2007-12-28 15:34 EST, David Carver CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Carver CLA 2007-06-30 14:11:40 EDT
The W3C has a publicly available XSLT Schema for XSLT 1.0 at:

http://www.w3.org/XML/2000/04schema-hacking/xslt.xsd

It would be nice to have this built into the XML Catalog, so that it is automatically available to users.  This would give the Eclipse Tools some basic built in support for editing XSLT style sheets.
Comment 1 David Carver CLA 2007-06-30 15:15:31 EDT
XSLT 2.0 schema can be found here:

http://www.w3.org/2005/02/schema-for-xslt20.xsd

Comment 2 David Williams CLA 2007-09-06 12:39:22 EDT
I've submitted these schemas for Eclipse IP Legal review
https://dev.eclipse.org/ipzilla/show_bug.cgi?id=1748 

Comment 3 David Williams CLA 2007-11-03 01:43:56 EDT
I went to add the entries to the XML Catalog, and became confused (what's new :) 

As far as I can see, the entries should be 

            <uri
                name="http://www.w3.org/1999/XSL/Transform"
                uri="xsd/xslt.xsd" />

            <uri
                name="http://www.w3.org/1999/XSL/Transform"
                uri="xsd/schema-for-xslt20.xsd" />


But, doesn't the namespace have to be unique? What's up with that? 
I'm just looking at the namespace that's listed at the beginning of 
each of the files. 

One says 

<schema targetNamespace="http://www.w3.org/1999/XSL/Transform" elementFormDefault="qualified" version="April 15, 2000">

The other says 

<xs:schema targetNamespace="http://www.w3.org/1999/XSL/Transform" elementFormDefault="qualified">


If that don't have to be unique, then that's fine ... but, would appreciate it if one of you experts confirmed what the entries should be in the plugin.xml file that is in 
org.eclipse.wst.standard.schemas

Thanks, 
Comment 4 David Williams CLA 2007-11-03 01:53:03 EDT
Oh, wait ... I think the browser's display was messing me up ... if I really look inside the file, the headers say 

<xs:schema 
           xmlns:xs="http://www.w3.org/2001/XMLSchema" 
           targetNamespace="http://www.w3.org/1999/XSL/Transform" 
           elementFormDefault="qualified" 
           xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

and 

<schema 
        xmlns='http://www.w3.org/1999/XMLSchema'
        targetNamespace='http://www.w3.org/1999/XSL/Transform'
        xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
        elementFormDefault='qualified'
        version='April 15, 2000'>

So, given that, I think the plugin.xml entries would be 

            <uri
                name="http://www.w3.org/1999/XMLSchema"
                uri="xsd/xslt.xsd" />

            <uri
                name="http://www.w3.org/2001/XMLSchema"
                uri="xsd/schema-for-xslt20.xsd" />

Feel free to correct me, 
or ... test out in a build in a few days! :) 

In other words, I'll release the files, and the plugin.xml and we can correct later, if it's wrong. 

Comment 5 David Williams CLA 2007-11-03 02:00:46 EDT
Marking as fixed, please verify in builds >= I20071104
Comment 6 David Carver CLA 2007-11-03 09:05:59 EDT
David, unfortunately, this is one of those cases where the XMLCatalog isn't going to work.   As the production XSLTs both use the same namespace.   It's the target namespace http://www.w3.org/1999/XSL/Transform that is the important.

Every XSLT will have a xmlns="http://www.w3.org/1999/XSL/Transform", and then it's up to an editor to check the version attribute to determine which schema to apply.

The fix you suggested would require all XSLT 2.0 files, to use the http://www.w3.org/2001/XMLSchema as the namespace for XSLT 2.0 files, unfortunately this would break tool compatibility for XSLT 2.0 files.

I think this bug is actually better attached to the XML Tools Development project as we will need to handle some of this programaticlly there based on some content-type extensions to the XML editor.

Comment 7 David Williams CLA 2007-11-03 16:26:38 EDT
(In reply to comment #6)
> David, unfortunately, this is one of those cases where the XMLCatalog isn't
> going to work.   As the production XSLTs both use the same namespace.   It's
> the target namespace http://www.w3.org/1999/XSL/Transform that is the
> important.
> 
> Every XSLT will have a xmlns="http://www.w3.org/1999/XSL/Transform", and then
> it's up to an editor to check the version attribute to determine which schema
> to apply.
> 
> The fix you suggested would require all XSLT 2.0 files, to use the
> http://www.w3.org/2001/XMLSchema as the namespace for XSLT 2.0 files,
> unfortunately this would break tool compatibility for XSLT 2.0 files.
> 
> I think this bug is actually better attached to the XML Tools Development
> project as we will need to handle some of this programaticlly there based on
> some content-type extensions to the XML editor.
> 

Thanks for the reminders Dave. I'll clone a new bug to cover the content assist. So, we'll count this bug as simply putting them in the XML Catalog for other tools to use. I assume that's still desirable? 

Should I include a third catalog entry ... 

            <uri
                name="http://www.w3.org/1999/XSL/Transform"
                uri="xsd/schema-for-xslt20.xsd" /> 

That would cover the version 2 case by default, or would that cause other confusion and problems? 

Comment 8 David Carver CLA 2007-11-03 21:40:08 EDT
At this point, having XSLT 1.0 support in the catalog would be desirable, and I think we can deal with not having XSLT 2.0 support.   We can add XSLT 2.0 support once the XDT project is under way.  It is deseriable though to have XSLT 1.0 support until that occurs.

Comment 9 David Carver CLA 2007-11-03 21:48:52 EDT
(In reply to comment #4)
> Oh, wait ... I think the browser's display was messing me up ... if I really
> look inside the file, the headers say 
> 
> <xs:schema 
>            xmlns:xs="http://www.w3.org/2001/XMLSchema" 
>            targetNamespace="http://www.w3.org/1999/XSL/Transform" 
>            elementFormDefault="qualified" 
>            xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 
> and 
> 
> <schema 
>         xmlns='http://www.w3.org/1999/XMLSchema'
>         targetNamespace='http://www.w3.org/1999/XSL/Transform'
>         xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
>         elementFormDefault='qualified'
>         version='April 15, 2000'>


The targetNamespace is what you need to be concerned with.   The XSLT folks when designing XSLT 2.0 did NOT change the namespace, which they probably should have but didn't.   

So, my recommendation right now is to only add in the XSLT 1.0 specification, and we'll handle XSLT 2.0 within the XDT project.

I also think we need to find a newer XSLT 2.0 schema.  I'll do some more searching.


Dave
Comment 10 David Williams CLA 2007-12-13 13:22:14 EST
I've removed the schemas from wst.standard schemas, for now, since I didn't do it right, and still seems like some work is needed to know the "right" way to do it? 

Also, it was pointed out to me, that if it is needed/used by incubator project only, then it would be best not to "leak in" to WTP proper. For example, some adopters may provide their own, so we don't want to interfere with that, at least not until the time we can say positively how adopters should react. 

So, I'll leave this bug in 'reopen' state, for now. 

Comment 11 David Williams CLA 2007-12-14 00:40:34 EST
Assigning to dave so this bug has a specific owner. Please re-assign if appropropriate. 
Comment 12 Jesper Moller CLA 2007-12-27 19:09:41 EST
The schema referenced in the original description text is obsolete, i.e. it's in the old (1999) schema grammar.

I don't know how to transform it into a "modern" one, and doing it by hand is very error-prone. Do you (anyone, really!) have a stylesheet handy which can do this?
Comment 13 David Carver CLA 2007-12-27 19:36:58 EST
(In reply to comment #12)
> The schema referenced in the original description text is obsolete, i.e. it's
> in the old (1999) schema grammar.

Jesper, the one in the first text seems to be accurate to XSLT 1.0, as XSLT 1.0 was approved as a recommendation in 16 November 1999.

http://www.w3.org/TR/xslt


> 
> I don't know how to transform it into a "modern" one, and doing it by hand is
> very error-prone. Do you (anyone, really!) have a stylesheet handy which can do
> this?

If you can tell me what is wrong, I can correct it.  These two schemas have passed IP review, just an fyi.


Comment 14 David Carver CLA 2007-12-27 19:54:47 EST
(In reply to comment #13)
> (In reply to comment #12)
> > The schema referenced in the original description text is obsolete, i.e. it's
> > in the old (1999) schema grammar.
> 

Jesper, never mind, I see what you mean, it's referring to the 1999 version of XSD.  I can correct this.  I work with XSDs on a daily basis, and this is one of the smaller ones I work with.   I'll post the corrected version here.

Comment 15 Jesper Moller CLA 2007-12-27 20:00:32 EST
(In reply to comment #14)
> 
> Jesper, never mind, I see what you mean, it's referring to the 1999 version of
> XSD.  I can correct this.  I work with XSDs on a daily basis, and this is one
> of the smaller ones I work with.   I'll post the corrected version here.
> 

I didn't read this until I already started writing a small XSL transformation to handle this. So unless you've already done this, I can handle it. I just had hoped there'd be an easy way.
Comment 16 David Carver CLA 2007-12-27 21:11:46 EST
Actually, I've almost got this converted.

Comment 17 David Carver CLA 2007-12-27 21:43:36 EST
Re-Opening as XSD for XSLT 1.0 has been rewritten to use the correct schema language specification.

Jesper this correctly validates in the XSD editor now, if you wouldn't mind helping me test it to make sure that it validates XSLTs correctly and provides the correct content assistance, I'd appreciate it.

I'll correct any errors we find before we put it into the Incubator repository.

Comment 18 David Carver CLA 2007-12-27 21:44:50 EST
Created attachment 85881 [details]
Corrects XSLT 1.0 xsd.

This corrects the W3 version so that it uses the XML Schema 2001 1.0 specification instead of the draft 1999 specification.
Comment 19 David Carver CLA 2007-12-27 22:39:31 EST
one issue with the xsd, the substitutionGroups aren't working right for param and variables, and with-param items.  I'm looking into it.
Comment 20 David Carver CLA 2007-12-28 00:31:20 EST
Created attachment 85884 [details]
Modified version of XSLT 2.0 schema to implement XSLT 1.0 spec

This replaces the original XSLT 1.0 schema.  It is based off the XSLT 2.0 schema.  There were numerous problems with the way the original XSLT 1.0 schema was structured.  The XSLT 2.0 schema works and validates XSLT 2.0 files fine.  It also validates XSLT 1.0 schemas, but would allow new elements in that aren't in the 1.0 specification.  This version, strips out all the XSLT 2.0 enhancements and attributes, and leaves us with a working XSLT 1.0 schemas.

One thing we should consider is adding in the appropriate annotation information so that documentation for an element is available with the content assistance.

I have verified it against a 9000 line XSLT 1.0 stylesheet, that implements pretty much every feature of XSLT 1.0.   The schema validated it correctly.  Validation took less than a second.
Comment 21 David Carver CLA 2007-12-28 15:34:58 EST
Created attachment 85915 [details]
Updated XSLT 1.0 xsd which contains documentation for attributes and elements.

This is the update to the XSLT to include the following:

1. W3C Copyright statement
2. Eclipse EPL statement.
3. Date of Modification and reason for creating derrivate work.
4. All elements and attributes now have appropriate annotation/documenation information for each item.

This will allows for the complete ability for Content Assist of XSLT, that also includes not only the content model, but any documentation for the particular elements and attributes available to be used at that particular point.

This works with the existing XML Editor through the use of either a XML Catalog or schemalocation attribute.  However, long term, the XSLT editor needs a way to specify the grammar to be used so that it may be applied.  In the initial version we can support only XSLT 1.0 through the use of the XML Catalog grammar contribution mechanism, because XSLT 1.0 and 2.0 both use the same namespace.

There is an open bug for an enhancement in 3.0 to allow the requested functionality required by an XSLT editor to contribute the grammar to be used for validation and content assistance.

Jesper if you could take a look at this and do some verification on it that it is indeed working, I'd appreciate it.   This will take care of many structural validations, but there are still a few dependency validations that will need to be handled by the XSLT interpretor when compiling the stylesheet.

David, please review this to make sure that I've covered everything that is needed for any additional IP review we may need to have done.  If it's okay, I'll get it attached to the appropriate CQ with an explanation of why we needed to update it.
Comment 22 David Williams CLA 2007-12-28 17:54:54 EST
(In reply to comment #21)
> Created an attachment (id=85915) [details]
> Updated XSLT 1.0 xsd which contains documentation for attributes and elements.
> 

> David, please review this to make sure that I've covered everything that is
> needed for any additional IP review we may need to have done.  If it's okay,
> I'll get it attached to the appropriate CQ with an explanation of why we needed
> to update it.
> 

Yes, looks fine to me. I would add an explicit encoding="UTF-8" to the XMLDecl, but looks like you have the IP stuff covered. 

Comment 23 David Carver CLA 2007-12-28 18:07:03 EST
A patch in bug 157254 fixes an issue discovered with documentation and content assist that this particular schema brought forward.  Bug 157254 needs to be fixed for this xsd to provide full functionality with annotations in content assist mode.
Comment 24 David Carver CLA 2007-12-29 12:28:06 EST
*** Bug 213854 has been marked as a duplicate of this bug. ***
Comment 25 David Carver CLA 2008-01-12 15:24:00 EST
This is implemented and targeted for M1.   This currently only supports XSLT 1.0, but will support xslt 2.0 or 1.0 in the future.
Comment 26 David Carver CLA 2008-06-05 21:41:26 EDT
Mass Migration to wtp.inc.xsl
Comment 27 David Carver CLA 2009-04-30 14:25:26 EDT
mass update to 3.1 target due to movement from wtp incubator to wtp source editing lost the original milestones.