Sen
Sen

Reputation: 327

In Eclipse 3.5 : Rewrite xsl import/include location behind the scenes so it will properly validate files

I'm using Ubuntu

I'm working with xsl files that have import or include statements like this

<xsl:import href="/xsl/content/contentsecondary.xsl"/>

Eclipse can't find this file because the /xsl/ isn't actually at the the root of the project, but is seen from the root of the web server because of this line in my etc/xml/catalog file:

<rewriteSystem systemIdStartString="/xsl/" 
    rewritePrefix="file:///home/someguy/workspace/someproject/include/xsl/"/>

So in order for eclipse's built in xsl validation to work, it needs to know the real location of /xsl/. Does anyone have any idea how to do this?

For now I've turned off error reporting on missing include files but still get errors on call-template calls to templates it can't find. I've never experienced our templates fully integrated with eclipses xsl features. I think it would provide some really great error checking/auto-completion that I'm missing out on.

Any help would be appreciated. Thanks.

Upvotes: 0

Views: 2487

Answers (3)

Rich Seller
Rich Seller

Reputation: 84058

I know this works for XML schema, it may work for XSL as well, I'm not in a position to test it at the the moment.

add a catalog contribution to Eclipse. Under Window->Preferences->XML->XML Catalog select User Specified Entries and then the Add button.

Upvotes: 1

Chris Scott
Chris Scott

Reputation: 1761

Another shot, but it's not exactly easy:

  • under "Run Configurations" create a new configuration for your scenario.
  • Under the processor tab, Install saxon as an installed processor
  • add an attribute called http://saxon.sf.net/feature/styleParserClass
    • this is where it gets tricky, you have to supply a parser class name in java that knows how to find your files. You'll then have to add this jar under your saxon processor configuration.

That should give you control of overloading the import and include stylesheet directives.

Almost certainly this won't validate in eclipse, but you should be able to run it and find your imports.

Upvotes: 1

Chris Scott
Chris Scott

Reputation: 1761

Is there any reason you can't replicate the structure under the deployment directory in your project dir? If you don't want to migrate the existing structure, you could replicate the rewrite in your project using symbolic links.

If you are worried not just about the content completion/validation, and want to run it, you could write a simple java client that provides it's own URIResolver to resolve URLS to that you obtain correct references.

I haven't yet made the move to Eclipse 3.5, but after reading a bit about it now, I think I'll do and grab a download.

Upvotes: 1

Related Questions