MyEclipse: [Workaround] XML Validation fails with XSLT

support-rkalla - Sep 27, 2005 - 05:21 PM
Post subject: [Workaround] XML Validation fails with XSLT
We noticed a few folks writing XSLTs having problems with validation failing, and the problem here is there is no official Schema for XSLTs, however there is a community maintained one that one of our developers made some fixes to in order to get inline with the current spec that should allow you to validate your transforms.

The link for the file is here: http://www.myeclipseide.com/examplecode/schema-for-xslt20.xsd

You will need to add this to your XML Catalog using the key: http://www.w3.org/1999/XSL/Transform

You can do that by navigating to Window > Preferences > MyEclipse > Editors > XML Editor > XML Catalog, clicking "Add" and filling out the information as follows:
URI: file:/<path to file>/schema-for-xslt20.xsd
Key Type: Public ID
Key: http://www.w3.org/1999/XSL/Transform

Where <path to file> is your path wherever you stuck the XSD.
lkb - Oct 03, 2005 - 07:23 PM
Post subject:
When I try to add it, it wont let me use "Public ID".

It forces to Namespace Name.

Then when I valitade an XSL file, it says "Validation Complete" but the box says no validator is set up for this type.
lkb - Oct 03, 2005 - 07:24 PM
Post subject:
Resource foo.xsl was not validated because none of the enabled validators validates that type of resource.
Validation of resource foo.xsl is complete.
support-rkalla - Oct 03, 2005 - 09:00 PM
Post subject:
Make sure your XML validator is enabled for your project and/or globally for the workbenhc.
knegarpetter - Nov 01, 2005 - 09:45 AM
Post subject:
I get the same result as lkb, and i (think) have the xml validator enabled, (how do i check that)

regards
Petter
support-rkalla - Nov 01, 2005 - 02:00 PM
Post subject:
You can check for your project level by opening up your project properties and going to MyEclipse-Validation, if they are all grayed out then you need to navigate to Window > Prefs > MyEclipse > Validation and check there.
pcwappdev - Feb 16, 2006 - 10:56 PM
Post subject:
I've followed the instructions here, but I still get the validation error:
2 cvc-elt.1: Cannot find the declaration of element 'xsl:stylesheet'. article_simple.xsl pcw/web/WEB-INF/xsl line 2 February 16, 2006

I've checked and I do have the xml validator enabled.

MyEclipse version info:
Version: 4.1.0
Build id: 20060122-4.1-GA

Eclipse version info:
Version: 3.1.2
Build id: M20060118-1600

any ideas? this is mostly just a nuisance, but it would be nice to get rid of this nuisance.
support-rkalla - Feb 16, 2006 - 11:02 PM
Post subject:
pcwappdev,
Be sure to clear your error markers then re-run validation. MyEclipse > Remove All Error Markers
pcwappdev - Feb 16, 2006 - 11:26 PM
Post subject:
i didn't have an option to remove all error markers, I right clicked on my project clicked on MyEclipse > Remove All Validation Markers

I then right clicked on my xsl file and clicked on "Validate XSL file", got the same error mentioned above.

I tried right clicking the xsl file and then clicking on MyEclipse > Run Validation, but I got the following error:
Resource /pcw/web/WEB-INF/xsl/article_simple.xsl was not validated because none of the enabled validators validates that type of resource.
Validation of resource /pcw/web/WEB-INF/xsl/article_simple.xsl is complete.

As I mentioned, xml validation is enabled for this project.

Thanks for the quick response
support-rkalla - Feb 16, 2006 - 11:46 PM
Post subject:
Can you post the contents of the file so I can dump it into a project on my end and try it out?
pcwappdev - Feb 16, 2006 - 11:49 PM
Post subject:
the validation fails for any kind of xsl file. Here is a very simple xsl file which on my system fails validation as described above.

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:variable name="apos">'</xsl:variable>
<xsl:template match="/"><xsl:apply-templates /></xsl:template>
</xsl:stylesheet>
support-rkalla - Feb 17, 2006 - 02:39 AM
Post subject:
Did you not follow the steps outlined in the first post of this thread? I just did and the file validates fine.
pcwappdev - Feb 17, 2006 - 06:26 AM
Post subject:
I did follow the steps outlined in the first post of this thread, and yet my xsl file still does not validate.

when i right click on my xsl and select "Validate XSL File", I get:
Severity Description Resource In Folder Location Creation Time Id
2 cvc-elt.1: Cannot find the declaration of element 'xsl:stylesheet'. article_simple.xsl pcw/web/WEB-INF/xsl line 2 February 16, 2006 10:17:35 PM 3366

when I right click on my xsl and select "MyEclipse > Run Validation", I get:
Resource /pcw/web/WEB-INF/xsl/article_simple.xsl was not validated because none of the enabled validators validates that type of resource.
Validation of resource /pcw/web/WEB-INF/xsl/article_simple.xsl is complete.

I should mention that previously, I had saved this file: http://www.myeclipseide.com/examplecode/schema-for-xslt20.xsd with an .xml extension. I noticed this and changed the extension to .xsd . Once I did this, the only options I had for "Key Type" when adding this file to the xml catalog are "Schema Location" and "Namespace Location". Currently the details for my user specified xml catalog are:
URI: platform:/resource/pcw/web/WEB-INF/xsd/xsl-schema.xml
Key Type: Schema Location
Key: http://www.w3.org/1999/XSL/Transform

But no matter what I select for Key Type, I still get the same errors when trying to validate the xsl file.
support-rkalla - Feb 17, 2006 - 08:26 AM
Post subject:
Change it to namespace, that is what I have mine set to.
pcwappdev - Feb 17, 2006 - 05:20 PM
Post subject:
hehehe, I figured out what it was, there was a trailing space in the key for the xml catalog, so the key was "http://www.w3.org/1999/XSL/Transform " instead of "http://www.w3.org/1999/XSL/Transform"

doh!

once I removed the trailing space, the xsl file validates.

thanks for your patience Riyad.
support-rkalla - Feb 17, 2006 - 06:13 PM
Post subject:
ahh I'm actually impressed you found that. I would have torn my hair out ;)
pcwappdev - Feb 20, 2006 - 08:10 PM
Post subject:
after all that, I've discovered that it doesn't really "validate" my xsl file, it just checks to see that it is well formed xml.

For example, the following xsl file:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:badxsl>some bad xsl</xsl:badxsl>
</xsl:stylesheet>

Validates fine under myeclipse, but it is clearly not valid xsl. It would be nice if the validation actually told me if my xsl file was valid xsl, not just well formed xml.
sanjeev_rao - Mar 09, 2006 - 09:51 PM
Post subject:
pcwappdev: Do you still see the problem you reported on Feb 20, 2006 - 12:10 PM?

Just curious.
sanjeev_rao - Mar 09, 2006 - 11:33 PM
Post subject:
Myeclipse support personnel: Please describe how you created that XSL file where you seemed to have full XSL edtor functionality especially validation and code-assist/code completion. For some reason, I do not seem to be able to get it to work.

Eclipse SDK
Version: 3.1.2
Build id: M20060118-1600

MyEclipse Enterprise Workbench
Version: 4.1.1 GA
Build id: 20060228-4.1.1-GA

Thanks again,
-Sanjeev
support-rkalla - Mar 10, 2006 - 03:46 PM
Post subject:
Sanjeev,
That was the point of this thread, be sure to start at the beginning of the thread: http://www.myeclipseide.com/index.php?name=PNphpBB2&file=viewtopic&t=9318&postdays=0&postorder=asc&start=0
aitia.int - Apr 26, 2007 - 06:37 PM
Post subject:
I have the same problem. I added an entry to the xml catalog as described above, but I still can't use auto completition, and validation. Do I have to do anything else?

This is the starting of my xsd:

<?xml version="1.0" encoding="ISO-8859-2"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

I'm using: eclipse 3.2.2, myeclipse 5.1.1. GA on windows
support-rkalla - Apr 26, 2007 - 07:16 PM
Post subject:
aitia.int,
What does your XML Catalog entry look like? What does your XML example doc look like?
aitia.int - Apr 26, 2007 - 07:30 PM
Post subject:
Thank you for the quick replay.

Now, it seems like the problem is solved. For some reason it did not work for the first time I tryed. I realy don't know what happened.
support-rkalla - Apr 26, 2007 - 09:04 PM
Post subject:
Strange, either way I'm glad it's working now.
All times are GMT - 6 Hours
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits